Languages :: PHP :: How to select a image file from a dropdown list |
|||
| By: PHP newbee |
Date: 13/03/2003 00:00:00 |
Points: 65 | Status: Answered Quality : Excellent |
|
I am trying to be create a dropdown list of all my .jpg files in a dir called <A HREF="http://localhost/images">http://localhost/images</a>. I would like to then select the image from the list and then display it. This might be easy but I just can't seem to get it. Thanks |
|||
| By: VGR | Date: 13/03/2003 09:11:00 | Type : Comment |
|
| 1) get all your files *.jpg via a dir(), readdir() or exec ("dir") 2) build the HTML page with a SELECT and one OPTION for each file 3) add an OnChange event handler / or (simplier) a button "view" 4) react to event / take action on button press to : 5) show the image in a separate/same window easy which part(s) of the above do require some coding help from my humble self ? |
|||
| By: PHP newbee | Date: 14/03/2003 23:20:00 | Type : Comment |
|
| Sorry, but being a newbie, I really don't see how to code this. (1-5) It looks like you want me to create a check box with all of my images as the options. I have a 2 hundred drawings (images) and a check box seems unpractical. Thanks fro responding though. |
|||
| By: VGR | Date: 15/03/2003 00:00:00 | Type : Answer |
|
| no checkbox, a SELECT. This is a listbox you asked for a dropdown list. That's a listbox. I'll try to help you anyway : I send you to the documentation of PHP (the online version is at <A HREF="http://www.php.net/manual/en/">http://www.php.net/manual/en/</a> 1) type "readdir" +ENTER and then "dir" +ENTER in the "search" textbox 2) you have to know how to build an HTML FORM 3) in the FORM , add a button : <input type=submit name=ipressedit value=View> Make sure the ACTION=$PHP_SELF 4-5) just before echoing the FORM to the "screen", place the action handling like this : (supposing register_globals=On, let's keep things as simple as they should be :D ) if (isset($ipressedit)) { // here display the selected image the way you want, either in an IMG tag either in a popup window, whatever // (6) } // if ipressedit NB (6) : put "exit;" here if you want to stop before re-displaying the selecting FORM |
|||
|
Do register to be able to answer |
|||
©2012 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








