Drop down list value for "Other" option

A

Anonymous

Guest
Hi guys; I need a little help; I have a drop down list:
Code:
<select name="car">
   <option>-Select Car-</option>
   <option value="MAZDA">MAZDA</option>
   <option value="OPEL">OPEL</option>
   <option value="Nissan">Nissan</option>
   <option value="Volvo">Volvo</option>
   <option value="">Other</option>
</select>

What I want is if user select the last option i.e. 'Other', they are required to specify the car they requested by entering car model in a text box (named car_other). Could someone please tell me how to insert this second value into a Mysql table.

F.Y.I I'm using php, Mysql and apache
 
interestin it's hard to change?:
Code:
<select name="car">
   <option>-Select Car-</option>
   <option value="MAZDA">MAZDA</option>
   <option value="OPEL">OPEL</option>
   <option value="Nissan">Nissan</option>
   <option value="Volvo">Volvo</option>
   <option value="other">Other</option>
</select>
 
here some pseudo code for it

$query = "INSERT INTO ...";
$query .= "some more";
if(car_is_other_condition) $query .= "value from text box";

that help?
 
IF I understand what you mean,
you want the script to use a text box value if the person has selected "Other"?

If that's right,

<select name="car">
<option>-Select Car-</option>
<option value="MAZDA">MAZDA</option>
<option value="OPEL">OPEL</option>
<option value="Nissan">Nissan</option>
<option value="Volvo">Volvo</option>
<option value="">Other</option>
</select>

That's fine, leave it as-is.

Code:
if ($car == "") { $car = $textbox with car in; }
$query = "INSERT into blah blah blah";
using the variable $car as your final value...

Andrew
 
That code goes in the submit PHP coding area by the way.

Andrew
 
Back
Top