[prog] hyperlinks and php

Jacinta Richardson jarich at perltraining.com.au
Wed Oct 8 14:01:07 EST 2003


On Tue, 7 Oct 2003, Saint-Wolfe wrote:

> Would anyone happen to know how to make this into an a href so that it 
> links to another php page?

> the first line where it says $row_Grade['c_code'] I need to be a 
> hyperlink to this a page that calls this information
> CourseDetails.php?code=$code&term=$term&year=$year&course=""
> 
> I thought maybe
> <a href=CourseDetails.php?code=$code&term=$term&year=$year&course=""> 
> <?php echo $row_Grade['c_code']; ?></a>

what you probably want is:

<?php 
echo '<a href="CourseDetails.php?code=' . $code . 
     '&term=' . $term . '&year=' . $year. 
     '&course=' . $row_Grad['c_code'] .
     '>' . $row_Grad['c_code'] . '</a>';
?>

although I might have misunderstood and you may not want 
	'&course=' . $row_Grad['c_code'] .
as you may want to leave course blank.

To set course to blank, just don't mention it.  It's not particularly
easy to set it explicitly to empty string in a GET string.  This is why
you often see code like:

if(defined $code && $code ne "")
{
}

although that's Perl, and the semantics in PHP may be subtly different.

> was perhaps the answer but I keep getting error messages, can anyone 
> shed any light on this?

If this doesn't answer the question post more code and include your
error messages

All the best,

	Jacinta

--
   ("`-''-/").___..--''"`-._          |  Jacinta Richardson         |
    `6_ 6  )   `-.  (     ).`-.__.`)  |  Perl Training Australia    |
    (_Y_.)'  ._   )  `._ `. ``-..-'   |      +613 9354 6001         |  
  _..`--'_..-_/  /--'_.' ,'           | contact at perltraining.com.au |
(il),-''  (li),'  ((!.-'              |   www.perltraining.com.au   |



More information about the Programming mailing list