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... Quote Link to comment 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) Quote Link to comment 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" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.