好像~直接名字不同PHP变量就不同咯

解决方案 »

  1.   

    switch ("按钮")
    {
    case "提交一":
        .....
        break;
    case "提交二":
        .....
        break;
    case "重写":
        .....
        
    }
      

  2.   

    <?php
    /*
    simple code
    */$a=trim($_POST['a']);
    $b=trim($_POST['b']);
    if ($_POST['qh'])
    {
    $result=$a+$b;
    }
    elseif ($_POST['qc'])
    {
    $result=$a-$b;
    }echo "$result";
    ?><form name="test" method="POST" action="">
    <input name="a" type="text">
    <input name="b" type="text">
    <input name="qh" type="submit" value="求和">
    <input name="qc" type="submit" value="求差">
    <input name="reset" type="reset" value="重写">
    </form>
      

  3.   


    <script language="javascript">
    function checkSub(str){
    if (str == 'qu0'){
      document.forms[0].action = 'test1.php';
      return true;
    }
    if (str == 'qu1'){
      document.forms[0].action = 'test2.php';
      return true;
    }}
    </script>
    <form name="test" method="post">
    <input type="submit" name="qh0" value="提交一" onclick="return checkSub('qu0');">
    <input type="submit" name="qh1" value="提交二" onclick="return checkSub('qu1');">
    <input name="reset" type="reset" value="重写"> 
    </form>