1

I have a HTML page with a form.

The form submits their address to my php page which has $_GET['address'];

I want to give users the option of selecting from a drop down box OR entering their address in a keyword box for the address part. But I want it to still submit as the same variable to my php page.

So I basically want a drop down box, where one of the options is an input box...or similar functionality as that...

Is this possible with HTML? or is there a better way to do this?

David19801
  • 11,214
  • 25
  • 84
  • 127
  • possible dup: http://stackoverflow.com/questions/2179576/writable-select-box | http://stackoverflow.com/questions/264640/how-can-i-create-an-editable-dropdownlist-in-html | http://stackoverflow.com/questions/2498713/html-select-and-text-input – dani herrera Jan 03 '12 at 19:31

2 Answers2

3

This is not possible solely with HTML, as it would submit the values of both the drop down box and the input box. If both fields were named "address" it would submit to your php page and be held in an array. In my opinion, some javascript on your HTML page could hide the input box if that option were not selected.

Radix
  • 667
  • 5
  • 28
1

As plan minimum - not using any UI components - you could have SELECT and INPUT TEXT with ability to add text to SELECT or enable INPUT TEXT when SELECT is set to "other"....

if you want be more fancy - use UI components from jQuery, Dojo, ExtJS or other framework of your choice.

bensiu
  • 24,660
  • 56
  • 77
  • 117