Jump to content

Recommended Posts

Hi,

i am working on designing a webpage. I give a list of options for the user to choose from and then once the user has choosen what they want the products avaliable on the option are displayed. The code i have used is:

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>";
}

Instead of having the list like this i want the user to be able to choose from a set of pictures. I have stored pictures in my database under the heading "pic". Now how do i change my code to enable me to display pictures which the user can select rather than a list???
Thanks
Link to comment
https://forums.phpfreaks.com/topic/3740-how-to-add-pictures-as-the-links/
Share on other sites

[!--quoteo(post=350181:date=Feb 28 2006, 11:40 AM:name=OriginalSunny)--][div class=\'quotetop\']QUOTE(OriginalSunny @ Feb 28 2006, 11:40 AM) [snapback]350181[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi,

i am working on designing a webpage. I give a list of options for the user to choose from and then once the user has choosen what they want the products avaliable on the option are displayed. The code i have used is:

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>";
}

Instead of having the list like this i want the user to be able to choose from a set of pictures. I have stored pictures in my database under the heading "pic". Now how do i change my code to enable me to display pictures which the user can select rather than a list???
Thanks
[/quote]

[code]
foreach($food_catagories as $key => $subarray)
{
     echo "<img src=\"$food_catagories[$key]['pic']\">";
[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.