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
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"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.