how to access javascript variable with php code
<pre><code>        function al(){
        var selr = jQuery('#grid').jqGrid('getGridParam','selrow');
        if(selr){
            &lt;?
                include_once("../../DB/singleton.php");
                $pDatabase = Database::getInstance();
                $c = $pDatabase-&gt;query("select c.city_title as 'City' from teamshuffle.tbl_city c, teamshuffle.tbl_sport_city s where c.tblcity_id = s.tblcity_id and s.tblsport_id = " . );
                while($r = mysql_fetch_array($c)){
                    echo("alert(\"" . $r[0] . selr . "\");");
                }
            ?&gt;

        }
    }
</code></pre>

<p>This is my javascript function. I need to access variable "selr" in the line </p>

<pre><code>echo("alert(\"" . $r[0] . $d . "\");");
</code></pre>
