Home  >  Article  >  Backend Development  >  Determine the difference between if($_POST[submit]) and if(isset($_POST[submit])) when submitting a form in PHP_PHP Tutorial

Determine the difference between if($_POST[submit]) and if(isset($_POST[submit])) when submitting a form in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:31:53934browse

This should be used if(isset($_POST['submit'])) {
}
The difference between if($_POST[submit]) and if(isset($_POST[submit])) when submitting a form

The first method will cause a warning, while the second method is relatively more rigorous.
Also, it is best to add single quotes to the POST key name, so that the efficiency is slightly higher (about 3-4 times).
Well, it almost means that. If this variable is set, it returns true

What does if(isset($_POST['Submit'])) mean in PHP?
isset -- Check whether the variable is set

Determine whether the posted data has been submitted

Copy the code The code is as follows:

if(isset ($_POST["submit"]){
echo "submit is no come~";
}else
{
echo "submit is no come~";
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322948.htmlTechArticle should be used like this if(isset($_POST['submit'])) { } when submitting the form if($ The difference between _POST[submit]) and if(isset($_POST[submit])) The first method will cause a warning, the second method is relatively more rigorous...
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