用$_POST取值,如果为空,就执行你填写的错误的格式!

解决方案 »

  1.   

    试试下面的代码:
    <?php
    if($Submit){
    if(strlen($test)>10){
    echo 'bingo!';
    }else{
    echo <<<JS
    <script language="javascript">
    alert('error');
    history.back(1);
    </script>
    JS;
    }
    }
    ?>
    <meta name="save" content="history">
    <style>
       .shistory {behavior:url(#default#savehistory);}
    </style>
    <form method="post">
    <input class="shistory" type="text" name="test">
    <input type="submit" name="Submit">
    </form>