alert("...");}" method can stop data submission."/> alert("...");}" method can stop data submission.">

Home  >  Article  >  Backend Development  >  How to stop submission in php

How to stop submission in php

藏色散人
藏色散人Original
2021-11-22 09:30:481311browse

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.

How to stop submission in php

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[&#39;user&#39;]?$_POST[&#39;user&#39;]:&#39;&#39;;
if(empty($user)){
echo &#39;<script type="text/javascript">alert("用户名不能为空");history.back(-1);</script>&#39;;
}
?>

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn