alert("...");}" method can stop data submission."/> alert("...");}" method can stop data submission.">
Home > Article > Backend Development > How to stop submission in php
php method to stop submission: 1. Create a PHP sample file; 2. Pass "if(empty($user)){
echo '4058752f785d925a16739924810b6e62alert("...");}" method can be used to stop data submission.
The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
How to stop submission in php?
Specific problem description:
How to stop submission if php verification fails?
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?
Solution:
The code is as follows:
<?php $user=$_POST['user']?$_POST['user']:''; if(empty($user)){ echo '<script type="text/javascript">alert("用户名不能为空");history.back(-1);</script>'; } ?>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to stop submission in php. For more information, please follow other related articles on the PHP Chinese website!