php中显示未定义
<body><palign="center"><formaction="dianhua.php"method="GET"><palign="center">请输入你要查询...
<body>
<p align="center"><form action="dianhua.php" method="GET">
<p align="center">请输入你要查询的手机号码:<input type="text" name="phone"></p>
<p align="center"><input type="submit" value="查询手机号码归属地" name="submit"></p>
</form>
<?php
$phone='';
$phone=$_POST['phone'];
if(strlen($phone)<7)
echo"<font color=red>手机号码最低7位哦</font>";
?>
</body>
为什么有提示Notice: Undefined index: phone in C:\Apache2.2\htdocs\dianhua.php on line 15 展开
<p align="center"><form action="dianhua.php" method="GET">
<p align="center">请输入你要查询的手机号码:<input type="text" name="phone"></p>
<p align="center"><input type="submit" value="查询手机号码归属地" name="submit"></p>
</form>
<?php
$phone='';
$phone=$_POST['phone'];
if(strlen($phone)<7)
echo"<font color=red>手机号码最低7位哦</font>";
?>
</body>
为什么有提示Notice: Undefined index: phone in C:\Apache2.2\htdocs\dianhua.php on line 15 展开
1个回答
2013-12-16
展开全部
如果提交时没有输入号码,则$_POST['phone'];是不存在的。帮$phone也是未定义的。你首先就应该用isset判断
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询