<script>
 function go()
  {
  <?php
  $query=mysql_query("select * from table where aa='".$aaaaaaaaaaaaa."'");
$rs=mysql_fetch_object($query);  
?>
var xxx=<?php echo $rs->aa;?>;
  }
<script>

解决方案 »

  1.   

    <script>
     function go()
      {
      <?php
     $yyy=$_POST['aaaaaaaaaaaaa'];
      $query=mysql_query("select * from table where aa='".$yyy."'");
    $rs=mysql_fetch_object($query);  
    ?>
    var xxx=<?php echo $rs->aa;?>;
      }
    <script>
    <form method="POST" action="thispage.php" name="form3">
     <input type="text" name="aaaaaaaaaaaaa">
    </form>
      

  2.   

    谢谢zeroleonhart(Strong Point:Algorithm) 
    是我没说清楚。
    JS和表单要放在同一页面,我就是不能得到javascript里的$aaaaaaaaaaaaa的值,有什么办法能得到$aaaaaaaaaaaaa的值吗?
      

  3.   

    $aaaaaaaaaaa is a variable in php,not in js.if you want get it,you must submit the form and use $_POST[] to get it.