Jump to content

Images as links


OriginalSunny

Recommended Posts

Hi,
I am trying to get a picture as my link to another page in php. The thing is when the user will click on the picture a query should also be performed. I am currently using the following code for the user to select an option and the queryto be performed:

FIRST PAGE(Catalog.inc)
foreach($food_categories as $key => $subarray)
{
echo "<h3>$key</h3>";
echo "<ul>";
foreach($subarray as $type)
{
echo "<input type='radio' name='interest'
value='$type'><b>$type</b><br>\n";
}
echo "</ul>";
}
echo "<p><input type='submit' name='Products'
value='Select Category'>\n

SECOND PAGE(Catalog.php)
$sql_cat = "SELECT DISTINCT class FROM food
ORDER BY class";
$result = mysql_query($sql_cat,$connect)
or die("sql_cat: ".mysql_error($connect));
while($row = mysql_fetch_array($result))
{
$food_categories[$row['type']][]=$row['class'];
}
include("catalog.inc");

As you can see a list of the class variables is displayed when the user clicks on the select category button. Now how do i use a picture instead?? I have stored the picture in my food database as foodpic. I am aware i will probably need to change code on both pages.
Thanks.
Link to comment
https://forums.phpfreaks.com/topic/5282-images-as-links/
Share on other sites

[!--quoteo(post=356400:date=Mar 19 2006, 07:55 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Mar 19 2006, 07:55 AM) [snapback]356400[/snapback][/div][div class=\'quotemain\'][!--quotec--]
basicly you'd need something like..

<a href=\"$row['food_link']\"><img src=\"$row['foodpic']\"></a>
[/quote]



What do you mean by [b]food_link[/b]??
Link to comment
https://forums.phpfreaks.com/topic/5282-images-as-links/#findComment-18815
Share on other sites

[!--quoteo(post=356400:date=Mar 19 2006, 07:55 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Mar 19 2006, 07:55 AM) [snapback]356400[/snapback][/div][div class=\'quotemain\'][!--quotec--]
basicly you'd need something like..

<a href=\"$row['food_link']\"><img src=\"$row['foodpic']\"></a>
[/quote]



What do you mean by [b]food_link[/b]??
Link to comment
https://forums.phpfreaks.com/topic/5282-images-as-links/#findComment-18829
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.