[eluser]Unknown[/eluser]
I have two drop down list. The second drop down list will depend on the selected value in the first drop down box.
in normal PHP the code for your view will just be:
$cntry = "Select name from country;";
$sql = mysql_query($cntry);
$country = $_POST['country'];
$query = "SELECT * FROM cities where country = '$country'";
<select name="country">
while($row = mysql_fetch_array($sql))
{ <option><?=$row['countryname']?></option> }
</select>
<select name="city">
while($result = mysql_fetch_array($query))
{ <option><?=$result['countryname']?></option> }
</select>
which means you can post the value you selected in the same page and use it to query.
but in codeigniter, you cannot do that. you cannot post data unless you pass it to a model or controller. The requirement of my site is after you select in the country, it will auto populate the second drop down list without going to other pages or clicking on any button.
any help will be appreciated.