php method to stop submission: 1. Create a PHP sample file; 2. Pass "if(empty($user)){ echo 'alert("...");}" method can be used to stop data submission. </p> </blockquote> <p><strong><img src="https://img.php.cn/upload/article/202111/22/2021112209273836056.jpg" alt="How to stop submission in php" ></strong></p> <p>The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer. </p> <p><strong>How to stop submission in php? </strong></p> <p><strong>Specific problem description: </strong><br></p> <p>How to stop submission if php verification fails? </p> <p>I performed non-null verification on the registration page. After prompting that the user name cannot be empty, the form was still submitted. How can I prevent the form from being submitted? </p> <p><strong>Solution: </strong><br></p> <p>The code is as follows: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><?php $user=$_POST['user']?$_POST['user']:''; if(empty($user)){ echo '<script type="text/javascript">alert("用户名不能为空");history.back(-1);'; } ?>Copy after loginRecommended learning: "PHP Video Tutorial"