Web Design Forum: PHP Drop down list, how can i add images? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PHP Drop down list, how can i add images? Rate Topic: -----

#1 User is offline   dan... 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 54
  • Joined: 28-January 10
  • Reputation: 0

Posted 11 March 2010 - 10:57 PM

Can anyone help, I would like the drop down list to display an image next to it when you select one of the selections, I also need it to display a short caption under the list so that it gives a brief description, can anyone help me with this as i've searched the web and it's not coming back with anything, here's the code i have so far to show you what i already have


<?php
require ("connect.php") ;
//extract data
$extract = mysql_query("SELECT * FROM image_styles ORDER BY id ASC") or die(mysql_error());
$numrows = mysql_num_rows($extract);
echo "<select name='styles'>";
while ($row = mysql_fetch_assoc($extract))
{
$id = $row['id'];
$styles = $row['styles'];
echo "
<option name='$id'>$styles </option>
";
}
echo "</select>";
?>
0

#2 User is offline   Milli05 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 64
  • Joined: 12-April 09
  • Reputation: 3
  • Gender:Female
  • Location:London
  • Experience:Beginner
  • Area of Expertise:Web Designer

Posted 12 March 2010 - 07:26 AM

Hi,
Unfortunately some browsers like IE do not show images in drop-down lists. I think you can see them in Firefox, but if you want to display important information, I would advise not to rely on the image in the drop-down list.
0

#3 User is offline   TopShopper 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 878
  • Joined: 21-July 09
  • Reputation: 14
  • Gender:Male
  • Location:Cardiff, UK
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 12 March 2010 - 07:36 AM

I think you are going to require some javascript client side to show the image of the styles that are selected.
0

#4 User is offline   dan... 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 54
  • Joined: 28-January 10
  • Reputation: 0

Posted 12 March 2010 - 09:19 AM

View PostTopShopper, on 12 March 2010 - 07:36 AM, said:

I think you are going to require some javascript client side to show the image of the styles that are selected.


ok, perhaps i should go back to the way i had it before and call upon the php as an action, this way i had it working correctly.

Can anyone point in the right direction for this now? Let's say i select one option from a drop down list, i then submit it, that stores in my database and i then go onto the next page, i then have another drop down box. How do i get it to only display the options depending on what was selected in the 1st drop down box?

Thanks in advanced.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users