new_php85 Posted October 7, 2008 Share Posted October 7, 2008 i every body... i need your opinion about drop down list. this is my sample code for drop down list Destination <select class="special" name="dest"> <option value="" selected>Choose Destination <option value="SZB">SZB <option value="MEL">MEL <option value="KCH">KCH <option value="KTN">KTN <option value="JHB">JHB <option value="BKI">BKI <option value="SBW">SBW <option value="MYY">MYY <option value="KBR">KBR <option value="IPH">IPH <option value="AOR">AOR <option value="TGG">TGG <option value="PEN">PEN <option value="BTL">BTL</select> Know i want change to.... Destination <select class="special" name="dest"> <option value="" selected>Add new destination <option value="SZB">SZB <option value="MEL">MEL <option value="KCH">KCH <option value="KTN">KTN <option value="JHB">JHB <option value="BKI">BKI <option value="SBW">SBW <option value="MYY">MYY <option value="KBR">KBR <option value="IPH">IPH <option value="AOR">AOR <option value="TGG">TGG <option value="PEN">PEN <option value="BTL">BTL</select> i want to know is it possible if when user click at "Add new destination" the statement come out with text field which is user need to key in the new destination where not in the list... if cannot do you have any suggestion how i need to make user able to add new destination for international. because the current list is for domestic... ??? thank you... Link to comment https://forums.phpfreaks.com/topic/127328-iiihelp-me-in-drop-down-list/ Share on other sites More sharing options...
Third_Degree Posted October 7, 2008 Share Posted October 7, 2008 Javascript. (Sorry to be brief, but I'm tired) Link to comment https://forums.phpfreaks.com/topic/127328-iiihelp-me-in-drop-down-list/#findComment-658717 Share on other sites More sharing options...
fanfavorite Posted October 7, 2008 Share Posted October 7, 2008 First off, I would look at valid code. You need to fix up your code to be: <select class="special" name="dest"> <option value="" selected="selected">Add new destination</option> <option value="SZB">SZB</option> ... </select> Now you shouldn't be posting this into PHP forum, it is javascript that you are looking for to trigger it: If you want to use PHP to reload the page with the changed value. For example, if you choose anything in the drop down, it will reload the page with the selected value as a $_GET var, which you can use an if statement to see if it is "Add new destination": <select class="special" name="dest" onchange="location.href='<? echo $_SERVER[php_SELF]."?selection=";?>'+escape(this.options[this.selectedIndex].text)"> Or you could write a javascript function and call it on the onchange and make it only do whatever you want if the value is "Add new destination" Link to comment https://forums.phpfreaks.com/topic/127328-iiihelp-me-in-drop-down-list/#findComment-658719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.