我有以下代码,我想验证表单以确保在提交 for 之前两封电子邮件都匹配。
电子邮件在第 24 和 26 行,提前致谢。
<?php
include_once 'includes/config.php';
$pageTitle = 'Members';
include HEADER;
?>
<?php
$fname = "";
$lname = "";
$email1 = "";
$email2 = "";
?>
<p>To create an account with us please fill out the form below</p>
<form action="sendRegister.php" method="get">
First Name: <input name="new[fname]" type="text"><br>
Last Name: <input name="new[lname]" type="text"><br>
</form>
Email : <input name="new[email1]" required="" type="email" value="<?php echo $email1;?>"><br>
Re-Enter Email : <input name="new[email2]" required="" type="email" value="<?php echo $email2;?>"><br>
Password: <input name="new[password1]" type="password"><br>
Re-enter password:<input name="new[password2]" type="password"><br>
Gender: <select name="new[gender]">
<option value="Male">
Male
</option>
<option value="Female">
Female
</option>
</select><br>
State of Residence:<select name="new[states]">
<option value="NY">
New York
</option>
<option value="NJ">
New Jersey
</option>
</select><br>
<br>
<?php
if(isset($email1) != $email2){
echo 'please correct your email';
}
?>
<input type='submit' value='submit'>
</form>
<?php
include FOOTER;
?>