每当我在表单中提交某些内容时,我想检查是否有任何字段为空.到目前为止,我所拥有的不起作用
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$username = $_POST['username'];
$password = $_POST['password'];
$passwordconf = $_POST['passwordconf'];
$email = $_POST['email'];
$securityq = $_POST['securityq'];
$qanswer = $_POST['qanswer'];
if(empty($firstname) || empty($lastname) || empty($username) || empty($password) || empty($passwordconf) || empty($email) || empty($securityq) || empty($qanswer))
{
echo "You did not fill out the required fields.";
}
Run Code Online (Sandbox Code Playgroud)
和形式
<form name="registrationform" action="register.php">
First Name:<input type="text" name="firstname">
Last Name:<input type="text" name="lastname">
Email:<input type="text" name="email">
Username:<input type="text" name="username">
Password:<input type="password" name="password">
Confirm Password:<input type="password" name="passwordconf">
Security Question:<input type="text" name="securityq"> …Run Code Online (Sandbox Code Playgroud) 是否可以将两个对象合并在一起?例如:
如果你有2个物体
Dim returnOptionObject1 As OptionObject
returnOptionObject1 = New OptionObject
Dim returnOptionObject2 As OptionObject
returnOptionObject2 = New OptionObject
Run Code Online (Sandbox Code Playgroud)
然后设置它们的值
returnOptionObject1.EntityID = OptionObject.EntityID
returnOptionObject1.OptionId = OptionObject.OptionId
returnOptionObject2.SystemCode = SystemCode
returnOptionObject2.Facility = OptionObject.Facility
Run Code Online (Sandbox Code Playgroud)
你能以某种方式将这些对象组合成一个新对象,如同
Dim newObject As OptionObject = returnOptionObject1 + returnOptionObject1
Run Code Online (Sandbox Code Playgroud)