<form action="?add"<?
if ($_REQUEST["action"]=="add"){
//post code.
}
?>

解决方案 »

  1.   

    <?
    if(isset($_POST))
    {
        表单处理
    }
    ?>
      

  2.   

    <?php
    if(isset($_POST['submit'])
    {
       表单处理 
    }
    ?>
      

  3.   

    <?
    $subm=$_POST["subm"];if($subm)
    {
    $var=$_POST["var"];
    echo $var;
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <form id="f" method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
    <input type="text" id="var" name="var" value="" />
    <input type="reset" id="reset" name="reset" value="reset" />
    <input type="submit" id="subm" name="subm" value="submit" />
    </form>
    </body>
    </html>
      

  4.   

    <form id="f" method="post" action=" <?=$_SERVER[ 'PHP_SELF '];? >" > 
    或<form id="f" method="post" action="" > 
    两种方式都可以
    然后就是对提交的内容在aa.php页面进行处理了