Parse error: syntax error, unexpected T_ECHO in
<p>all code is:</p>

<pre><code>$(document).ready(function(){
    $('#sub').click(function() {
        var r = confirm("سلام")
        if (r==true){
        var in_code=document.getElementsByName("code")[0].value;
        var echo="&lt;?php
        include ('conect.php');
        $res2=mysql_query("select * from products where code=".echo('document.write(in_code);');." ");
        $row2=mysql_fetch_array($res2);
        echo $row2['name'];
          ?&gt;" 
        alert(echo);            }
        else {
            document.getElementById("frm1").reset();
            } 
</code></pre>

<p>in this line error:</p>

<pre><code>$res2=mysql_query("select * from products where code=".echo('document.write(in_code);');." ");
</code></pre>

<p>echo('document.write(in_code);'); is not work</p>

<p>how to fix t his or It did better?</p>
