Jump to content

Problem with PhP MySql Ajax dropdown script


StefanRSA

Recommended Posts

HI, I am using Roshan's Ajax dropdown code for my two ajax dropdown menus.

 

All is working fine, but when I want to use $_POST in the submitted form with FireFox, its not working...??? Its working fine in IE.

 

Can anybody please help me with this problem?

 

The Form where the dropdown is:

<!-- Province goes here -->
<tr>
   <td>-</td><td>-</td><td>-</td><td>-</td><td>Province</td><td>
  <select name="province" onChange="getCity('../dir/townsrc.php?province='+this.value)">
  <option value="">Select Province</option>
  <option value="1">KwaZulu-Natal</option>
  <option value="2">Western Cape</option>
  <option value="3">Eastern Cape</option>
  <option value="4">Free State</option>
  <option value="5">Gauteng</option>
  <option value="6">Limpopo</option>
  <option value="7">Mpumalanga</option>
  <option value="8">North West</option>
  <option value="9">Northern Cape</option>
  </select>
</td>
</tr>
<!-- Province ends here -->
<!-- Town goes here -->
<tr>
   <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td>
  <div id="citydiv"><select name="city">
<option>Select Town</option>
     </select>
</div>

  </td>
</tr>
<!-- Town ends here -->

 

The townsrc.php

<? $country=intval($_GET['province']);

$query=("SELECT * FROM search_town
WHERE provId=$country
ORDER BY townLabel ASC");
$result=mysql_query($query);

?>
<select name="city">
<option>Select Town</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value><?=$row['townLabel']?></option>
<? } ?>
</select>

 

The submit for:

$province = trim($_POST['province']);
$city = trim($_POST['city']);

 

In IE $province and $city gets posted

In FF only $province gets posted

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.