In my script amongst other variables, I have:

sql3="select * from inter_agents where id='$id_session'";
$result3=mysql_query($sql3,$conn) or die(mysql_error());
$agent_id = $regist3["id"];
$countrycode = $regist3["code"];
$cod_state = $regist3["cod_state"];
$cod_city = $regist3["cod_city"];
$cod_town = $regist3["cod_town"];

And so onů

Further down after started the javascipt

$("#cod_state").change(function(){ loading_city(); });
$("#cod_city").change(function(){ loading_city(); });

function loading_state() {

$.post("state.php", { country:"607" }, function(valor) {
if(valor == false) {
} else {
<?php if($cod_state) { echo '$("#cod_state").val("'.$cod_state.'"); $("#cod_state").change();'; } ?>
And so on

It is working fine.


If in DB the $countrycode value is different then 607, because is another country, how do I make the variable in the same place where the number 607 is placed.

$.post("state.php", { country:"607" }, function(valor) {

I hope I heve made myself clear.

Thanks a lot

How can I do to change this value depending