Parsing Dependent Dropdown SelectedIndex Values into MySQL?
Posted: Sat Jul 25, 2009 6:43 am
Hello everybody!
So I have 3 dropdown menus and 2 of them are dependent I made this using JavaScript.. (ex: country, state, province)
They work perfect except when I try to parse the selected items from the dropdown menus they return values like "123, "33", "366"( that is what i see in my MySql database) How do I parse the selectedindex or the "text" instead of the value?
Here a little bit of code:
$sehir = $_POST['sehir'];
$sql = mysql_query("INSERT INTO myMembers (sehir)
VALUES('$sehir)")
or die (mysql_error());
<select name="sehir" class="formFields" id="sehirler" >
<option value="?php print "$sehir"; ?"><?php print "$sehir"; ?></option>
<option value="">Şehir Seçiniz</option>
<option value="1">ADANA</option>
<option value="72">ADIYAMAN</option>
...
...
Thanks in advance!!
~Kaan
So I have 3 dropdown menus and 2 of them are dependent I made this using JavaScript.. (ex: country, state, province)
They work perfect except when I try to parse the selected items from the dropdown menus they return values like "123, "33", "366"( that is what i see in my MySql database) How do I parse the selectedindex or the "text" instead of the value?
Here a little bit of code:
$sehir = $_POST['sehir'];
$sql = mysql_query("INSERT INTO myMembers (sehir)
VALUES('$sehir)")
or die (mysql_error());
<select name="sehir" class="formFields" id="sehirler" >
<option value="?php print "$sehir"; ?"><?php print "$sehir"; ?></option>
<option value="">Şehir Seçiniz</option>
<option value="1">ADANA</option>
<option value="72">ADIYAMAN</option>
...
...
Thanks in advance!!
~Kaan