您好,我希望使用Preg_Replace函数,只要我检查输入的用户是否输入任何值。如果没有给出这样的错误消息“请输入你的名字吗”,但不是这个我收到此错误:Preg_Replace在空值中给出错误
公告:未定义指数:用C buildingslabs:\ XAMPP \ htdocs中\ spdealers \管理员
面板\ Property_Insert_Page_exe.php上线24
这里是我的代码:
<?php
$buildingslabs = preg_replace("[^A-Z a-z0-9]", "", $_POST['buildingslabs']);
if(empty($buildingslabs)
{
echo 'Plese Enter the Buildings Labs';
}
else
{
echo 'successfully inserted';
}
?>
你应该总是对'Post'和'Get'值使用'isset',然后检查它们是否为'empty' – 2013-04-10 04:30:27