这样判断也可以啊
<?
if (isset($_GET['id']) && $_GET['id']){
  do something ..
} else {
  echo "<form></form>";
}
?>

解决方案 »

  1.   

    谢谢二位,还有一个问题跟这相关的.
    test.php是父页面,work.php是子页面
    //test.php
    function f(s)//s是一个查询返回的数据库id字段
     {
    var ret=window.showModalDialog("work.php",null,"dialogWidth=210px;dialogHeight=100px;status:no;edge:sunken;scroll:no");
    if(ret)
    {    form1.action="test.php?id="+s;
      form1.submit(); }
    else
    {
      form1.action="test.php?id="+s;
      form1.submit();
    }
     }
    //work.php
    function trans(tag){   if (tag==1)
         window.returnValue=true;
       else
         window.returnValue=false;
       
        window.close();} 
    <input name="yes" type=button value="是" onclick="trans(1)">
    <input name="yes" type=button value="是" onclick="trans(0)">
    test.php父页面根据子页面的"是"或"否"来执行两个除了字段值不一样语句.为了不影响其他语句执行,这两个语句应该放在test.php最上面,进行判断来处理.本来想通过判定submit是否提交过来进行执行sql,但是f(s)肯定是无法达到这个效果的,应该改哪?不知道如何处理
      

  2.   

    <script>
    function check()
    {
       if(form.a.value!="") return true;//不为空,则允许提交
       else return false;
    }
    </script>
    <form name=form action=newpage.php onsubmit="return check();">
    <input type=text name=a></input>
    <input type=submit>
    </form>