Load images from dir

Hello to all. Today i need your help…

I want to load all .png images from directory (skins), and show them in select menu (dropdown(http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2)).

Thanks,
Martin Bojmaliev

what you want can be done with javascript and the selectedindex change event for your dropdown menu

yes and also i asked it on javascript help forum :slight_smile:

well since this is a php forum, i can help you with anything related to php since i got no javascript skill, however im not the only one here maybe other buddies will jump and help you.

Good luck

you can do it with php
[php]

<? $filedir='yourdirectory/*'; $filedir1='yourdirectory/'; $glob = glob($filedir); //echo $file; //} ?> <? foreach($glob as $file) { $file1=str_replace("$filedir1","",$file); echo '
'; echo "$file1"; } ?> [/php]

Ok thanks for support :slight_smile:

Really thanks for your help :slight_smile:

you can try what cabalsdemon suggested, however if you need image to change as selectedindex change you need an event hanlder which php dont have. you need javascript or ajax which is almost the same

yes i want that, i also post there how i can do it with javascript. Example the php part is ready from you. Thanks :slight_smile:

your welcome

also these kind of question have been asked and answered before.

google search is your friend


https://www.google.com/search?aq=0&oq=javascript+change+image+on+drop&sugexp=chrome,mod=17&sourceid=chrome&ie=UTF-8&q=javascript+change+image+on+dropdown

i know, but some of codes don’t work :slight_smile: :smiley: Some are so biggest and i dont want very compicated scripts. i want simple script because when i will see the script i will learn from it and in future i will use it again if i need :slight_smile: thanks

how many select name=?'s are you going to have

100 or 150 i dont know, i want make it for skin change UCP for my samp server

cabalsdemon i have a little problem with your script, i get something bad http://img841.imageshack.us/img841/6973/91ca26428fe242479ff106a.png , i dont edit your text :slight_smile:

http://moonchild.ezewh.com/5/glob1.php

this is my file that i used to make that what i gave you

i dont know ://

ok put the script up i gave you and i will put mine up and i will figure out that problem

LoL, i have saved the file .html lol im stupid :DD thanks the script, it works now :slight_smile:

THANKSS :slight_smile:

your welcome but html is not php so how does it work

Sponsor our Newsletter | Privacy Policy | Terms of Service