• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

How to select a image file from a dropdown list

I am trying to be create a dropdown list of all my .jpg files in a dir called http://localhost/images. 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

0
mratcliffe
Asked:
mratcliffe
  • 3
1 Solution
 
VGRCommented:
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 ?
0
 
mratcliffeAuthor Commented:
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.
0
 
VGRCommented:
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 http://www.php.net/manual/en/
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
0
 
VGRCommented:
thanks for grade B
did I answer precisely a precise question ? I think so.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now