Jump to content

iii...help me in drop down list


new_php85

Recommended Posts

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

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"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.