[eluser]ggoforth[/eluser]
[quote author="ivahdam" date="1244546310"]yes getStates(); is a js function which returns a country code, and this is working fine
i.e. $data has country code.
if I edit my code as
function stateDisplay(){
$data = '[removed]getStates();[removed])';
query = $this->db->query("select * from states where country_code = '".$data."'");
echo $this->db->affected_rows();
echo "<select name='state_code' id='state_code'>
<option value=''>Select State</option>";
foreach($query->result() as $row1) {
echo "<option value='".$row1->state_code."'> ".$row1->state_name."</option>";
} "</select>";
}
It displays affected rows as 0, where an in database there are 2 records for that country code.[/quote]
What I am not understanding is how you are running a javascript function (client side) inside PHP (serverside). At the time you call stateDisplay() (which is PHP...right?) you wouldn't have access to the client side functions, IE getStates(). I don't understand the flow of how your calling the stateDisplay().
Am I missing something here? Anyone...?
Greg