<form>
<input type='text' name='test'>
<input type='button' onclick='this.form.submit()'>
</form>
<?
echo $test;
?>

解决方案 »

  1.   

    <body>
    <form action="cc.php" method=post name=form>
    <input type='text' name='test'>
    <input type='submit' onclick='document.form.submit()'>
    </form>
    <?
    echo $_POST['test'];
    ?></body>
      

  2.   

    <body>
    <form action="cc.php" method=post name=form>
    <input type='text' name='test'>
    <input type='button' onclick='document.form.submit()'>
    <input type="button">
    </form>
    <?
    echo $_POST['test'];
    ?></body>
      

  3.   

    安全一点的话就:
    <body>
    <form action="cc.php" method=post name=form>
    <input type='text' name='test'>
    <input type='text' name='test2'>
    <input type='button' onclick='document.form.submit()'>
    <input type="button">
    </form>
    <?
    if(isset$_POST['test']) { //add this to check
      echo $_POST['test'];
      echo $_POST['test2'];
    }
    ?></body>