Page 1 of 1

Passing Multiple Parameters to an img src

Posted: Mon Jul 14, 2008 8:00 am
by LucyC
Hi,

I wish to pass multiple parameters to an img src. I already have successfully passed the one parameter using the following code:

<img src="Chart.php?graphdata1=<?php echo $datacolumns1 ?>">

can anyone tell me what the syntax would be to pass a second parameter? eg if I wished to pass $datacolumns2 as graphdata2, maybe something like (although this doesn't work)....

<img src="Chart.php?graphdata1=<?php echo $datacolumns1 graphdata2=<?php echo $datacolumns2 ?>">

Many thanks

Re: Passing Multiple Parameters to an img src

Posted: Mon Jul 14, 2008 8:44 am
by Dynamis
You were very close. If you are using the GET method, which I assume you are by your code, you need "&" between all of your variables. The following code should work correctly.

Code: Select all

<img src="Chart.php?graphdata1=<?php echo $datacolumns1; ?>&graphdata2=<?php echo $datacolumns2; ?>">

Re: Passing Multiple Parameters to an img src

Posted: Tue Jul 15, 2008 8:52 am
by LucyC
Many thanks for this - it works!