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

form表单提交后提醒 Undefined variable

WBOY
Release: 2016-06-13 12:24:45
Original
1546 people have browsed it

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

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template