Jump to content


Photo

Images as links


  • Please log in to reply
3 replies to this topic

#1 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 19 March 2006 - 11:49 AM

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.

#2 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 19 March 2006 - 12:55 PM

basicly you'd need something like..

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

#3 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 19 March 2006 - 03:50 PM

[!--quoteo(post=356400:date=Mar 19 2006, 07:55 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Mar 19 2006, 07:55 AM) View Post[/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 food_link??

#4 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 19 March 2006 - 05:52 PM

[!--quoteo(post=356400:date=Mar 19 2006, 07:55 AM:name=tjhilder)--][div class=\'quotetop\']QUOTE(tjhilder @ Mar 19 2006, 07:55 AM) View Post[/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 food_link??




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users