【发布时间】:2011-08-07 08:48:27
【问题描述】:
当用户提交没有任何参数的表单时,我想重定向到有表单的页面,同时我想返回错误消息,如何从控制器重定向到表单?
<form action="controllers/Customer.controller.php" method="post">
<label for="cellPhoneNo">cell phone number</label>
<input type="text" name="cellPhoneNo" class="textField"/>
<label for="telephone">telephone number</label>
<input type="text" name="telephone" class="textField"/>
<input type="submit" name="searchCustomer" value="بحث"/>
</form>
这是 Customer.controller.php 页面
if(trim($_POST['cellPhoneNo']) == "" && trim($_POST['telephone']) ==""){
//include('Location:index.php'); //what I supposed to write here?
echo "empty";
}
【问题讨论】:
标签: php forms validation redirect