Home  >  Article  >  Backend Development  >  form表单提交后提醒 Undefined variable

form表单提交后提醒 Undefined variable

WBOY
WBOYOriginal
2016-06-13 12:24:451506browse

form表单提交后提示 Undefined variable
表单提交之后提示num_tries变量未定义,可是明明在第3行就定义了啊
------解决思路----------------------
第三行改一下:(int)强制类型转换的对象应该是$_POST吧。。。

$num_tries = (isset($_POST['num_tries'])) ? ((int)$_POST['num_tries']+1) : 1;

------解决思路----------------------
第 3 行应为
$num_tries = (isset($_POST['num_tries'])) ? $_POST['num_tries']+1 : 1;
不需要强制类型转换

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