[prog] hyperlinks and php

Jacinta Richardson jarich at perltraining.com.au
Wed Oct 8 14:53:41 EST 2003


On Wed, 8 Oct 2003, wolf wrote:

> Thank you for responding : )

G'day Wolf,

While I'm happy to help people I'd prefer to keep such correspondance on
the list as then everyone can learn.  Please refer all questions to the
list rather than to me directly.

> >> <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.

> That produced an error that said unexpected ; found

How bizarre.  I can see one error, I forgot to close my "s inside the
html.  It should have been:

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

How about you print the above URL to STDERR too and see what it's
building.  As for the unexpected ; without seeing exactly how you used
my code (and I couldn't see it in your code) I can't even hazard a guess
why it's unhappy.

> I attached the php file, I don't really know which bits of code are 
> important and which bits aren't
> to know what to include : )

If you don't know this then I'm probably not going to know either.  Why
don't you see if you can approach the problem from another side and see
if you can get a simple script working and then when you know that that
works, see if you can incorporate the relevant pieces into your
script...?   Something like this perhaps:

<?php
	$term = 1;
	$year = 2;
	$row_Grad['c_code'] = "123";

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

If that works then you know the problem is somewhere else...

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