browser compatibility problem

Discussion in 'PHP' started by Balamurali, May 23, 2008.

  1. #1
    i have ajax script, its work in IE but not in mozilla. Actually there is no problem in ajax but the value has not posted.
    Example :

    if i select the state, the correspondent cities will display but the value of the city could not get another page.


    <form method=post action=next.php>
    <select name="state" class="selectfield" id="state" onChange="javascript:selectcity()">
    <option value="">..Select State..</option>
    <?
    $sql_state = "select * from {$prefix}state order by statename";
    $res_state = $DB->doSQL($sql_state);
    while($row_state = @mysql_fetch_assoc($res_state))
    {
    ?>
    <option value="<?=$row_state[stateid]?>">
    <?=$row_state[statename]?>
    </option>
    <? }?>
    </select>




    javascirpt
    function selectcity()
    {
    val=document.sea_agency.state.value;
    xhReq.open("GET", "ajaxval.php?id="+val, true);
    xhReq.onreadystatechange = onSumResponse1;
    xhReq.send(null);
    }
    function onSumResponse1()
    {
    if (xhReq.readyState != 4) { return; }
    var serverResponse = xhReq.responseText;
    var cell = document.getElementById("fac_c");
    cell.innerHTML = serverResponse;
    }


    ajaxval.php
    -------------
    <select name="city" class="selectfield" id="city" >
    <option value="">..Select City..</option>
    <?php
    include_once("includes/checksession.php");
    $getRes = mysql_query("select * from cities where stateid = '$_GET[id]' order by cityname");
    if($getRes)
    {
    if(mysql_num_rows($getRes) > 0)
    {
    while($getRow = mysql_fetch_assoc($getRes))
    {
    ?><option value="<?=$getRow['cityid']?>"><?=$getRow['cityname']?></option>
    <?php
    }
    }
    }
    ?></select>


    if i posted this value


    next.php
    ---------
    $cityname=$_REQUEST['city'];

    here i could not get the value of the city.

    But its work in IE, anybody know the problem?
     
    Balamurali, May 23, 2008 IP