Hi all me again! I really enjoy the help i have had so far and would love more assistance as i am heading into stage two of a new project.

I am trying to create an image based dropdown menu where a dropdown menu on one part of the page displays text as another table on a different part of the page displays an image based on the text in the dropdown.

    Yes? And? What you're describing sounds like it has nothing to do with PHP and everything to do with HTML/CSS and probably JavaScript. On that basis I'm moving the post to the client side forum.

      <img id="changeMe" src="http://example.com/pic.jpg"/>
      <select onchange="changeImage(this)">
      	<option value="">Select image</option>
      	<option value="http://example.com/pic1.jpg">Pic of some stuff</option>
      	<option value="http://example.com/pic2.jpg">Pic of other stuff</option>
      </select>
      
      function changeImage(o) {
      	if (o.value != "")
      		document.getElementById('changeMe').src = o.value;
      

        i also need to make sure that i keep the value numbers in it for SQL purposes - how wouldi do that?

          Any number of ways. E.g. always set src to a php script and just add the image's id from the DB as a query parameter for the browser's get request and let your php script serve the image, or put the id in the alt tag of the image, or in the id tag (making certain it doesn't clash with any other id) or adding a new attribute for images, such as imageid (and updating your doctype specification accordingly so you don't break validation), or just keep id_pathtopic in the value attirbute of the option elements, and then parse out the part you need.

            Write a Reply...