OriginalSunny Posted March 19, 2006 Share Posted March 19, 2006 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 foodORDER 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 More sharing options...
tjhilder Posted March 19, 2006 Share Posted March 19, 2006 basicly you'd need something like..<a href=\"$row['food_link']\"><img src=\"$row['foodpic']\"></a> Link to comment https://forums.phpfreaks.com/topic/5282-images-as-links/#findComment-18794 Share on other sites More sharing options...
OriginalSunny Posted March 19, 2006 Author Share Posted March 19, 2006 [!--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 More sharing options...
OriginalSunny Posted March 19, 2006 Author Share Posted March 19, 2006 [!--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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.