[SOLVED] form to image link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nex
Forum Newbie
Posts: 5
Joined: Tue May 11, 2004 8:54 am

[SOLVED] form to image link

Post 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.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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>
nex
Forum Newbie
Posts: 5
Joined: Tue May 11, 2004 8:54 am

Post by nex »

it doesnt work

Do I need to put anything in the image.php to get the 'quote' processed by the script?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

tog et eh quote in image.php just use:

$_GET['quote']
nex
Forum Newbie
Posts: 5
Joined: Tue May 11, 2004 8:54 am

Post 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());

?>
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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 *
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

and are you getting any errors? If so... what are they?
nex
Forum Newbie
Posts: 5
Joined: Tue May 11, 2004 8:54 am

Post by nex »

I does work now, thanx

syntax error:)
Post Reply