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());
$regist3=mysql_fetch_array($result3);
$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

$(document).ready(function(){
loading_state();
$("#cod_state").change(function(){ loading_city(); });
$("#cod_city").change(function(){ loading_city(); });
$("#cod_city").attr("disabled",true);
$("#cod_town").attr("disabled",true);
});

function loading_state() {

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

It is working fine.

BUT:

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