Page 1 of 1

[SOLVED] form to image link

Posted: Sat May 29, 2004 4:22 pm
by nex
Could anyone advise

Is it possible to pass a variable to an image link

<img src="image.php"? <? $quote = $GET_['quote']?> border=0 align=center width=300 height=200></p>

image.php is line chart, so im trying to pass a table name (from a form) to draw the data from.

Posted: Sat May 29, 2004 6:01 pm
by Illusionist
well have you tried it?? It will work, but your syntax is wrong.

try this instead:
<img src="image.php?quote=<?php echo $_GET['quote']; ?>" border=0 align=center width=300 height=200></p>

Posted: Sat May 29, 2004 6:18 pm
by nex
it doesnt work

Do I need to put anything in the image.php to get the 'quote' processed by the script?

Posted: Sat May 29, 2004 8:12 pm
by Illusionist
tog et eh quote in image.php just use:

$_GET['quote']

Posted: Sun May 30, 2004 3:40 am
by nex
tried that didnt work,

Code: Select all

$quote = $_GET['quote'];

$connection = mysql_connect($host,$dbuser,$dbpassword);
if(!$connection)
die("Couldnt connect");

mysql_select_db($database, $connection)
or die("couldnt connect to db".mysql_error());

$res = mysql_query("select* from $quote")
or die("SELECT error".mysql_error());

?>

Posted: Sun May 30, 2004 10:39 am
by Illusionist
ok, what are you trying to do?? wahtever your passing in as quote... do you have a table named that in your database?? And you might want to put a space between select and *

Posted: Sun May 30, 2004 10:39 am
by Illusionist
and are you getting any errors? If so... what are they?

Posted: Sun May 30, 2004 3:18 pm
by nex
I does work now, thanx

syntax error:)