我有一个带有表单的页面,分成两半,带有布局div。右侧根据用户先前的选择动态生成输入,以确定他们预订了多少用户。
整个过程由PHP处理。表单操作设置为页面本身。在提交时,表单被验证,如果通过,则用户被重定向到下一步。如果验证失败,则会正确生成错误消息。
在Firefox和Chrome中可以正常使用,但在设置为IE8兼容模式时,IE11 中的不是,除了。在IE11(10和9兼容模式)中,单击提交按钮时绝对没有任何反应。没有错误记录到控制台,没有提交任何内容,页面不会重新加载。在IE8模式下,它工作正常。
页面加载时发生的唯一控制台警告是两个不匹配的结束标记。它找到的第一个不匹配是第一个结束</div>
标记。第二个不匹配是结束</form>
标记。
<div class="6u">
<form id="buy-form" name="details" action="booking3.php" method="post">
<fieldset>
<legend>Enter Billing Details</legend>
<label for="first_name" class="register">First Name</label>
<input type="text" id="fname" name="first_name" class="textbox booking required" size="20" maxlength="20"
value="<?php if (isset($_SESSION['first_name'])) {
echo $_SESSION['first_name'];
} ?>"/><br/>
<label for="last_name" class="register">Last Name</label>
<input type="text" id="lname" name="last_name" class="textbox booking required" size="20" maxlength="20"
value="<?php if (isset($_SESSION['last_name'])) {
echo $_SESSION['last_name'];
} ?>"/><br/>
<label for="email" class="register">E-mail Address</label>
<input type="email" id="emai" name="email" class="textbox booking required" size="20" maxlength="60"
value="<?php if (isset($_SESSION['email'])) {
echo $_SESSION['email'];
} ?>"/><br/>
<label for="telephone" class="register">Telephone</label>
<input type="text" id="tel" name="telephone" class="textbox phonenumber booking required" size="20"
maxlength="20" value="<?php if (isset($_SESSION['telephone'])) {
echo $_SESSION['telephone'];
} ?>"/><br/>
<label for="address">Billing Address</label>
<textarea class="order required" name="address"><?php if (isset($_SESSION['address'])) {
echo $_SESSION['address'];
} ?></textarea>
</fieldset>
</div>
<?php
if ($_SESSION['userno'] >= 1) { // if more than one user is selected, display text boxes to take extra user details
echo '<div class="6u content content-right">';
if ($_SESSION['userno'] == 1) {
echo '<span>Please enter the name, e-mail address and telephone number of your user.</span><br/>';
} else {
echo '<span>Please enter the names, e-mail addresses and telephone numbers of your '.$_SESSION['userno'].' users.';
}
for ($i = 0; $i < $_SESSION['userno']; $i++) { //create textboxes for the appropriate amount of users based on userno selection
echo '<fieldset><legend>User '.($i + 1).'</legend>';
if ($i == 0) {
echo '<label class="register">As Billing Details</label><input id="userisbooker" type="checkbox" class="booking"/><br/>';
}
echo '<label for="userFname[]" class="register">First Name: </label><input type="text" id="fname'.$i.'" name="userFname[]" class="textbox booking required" value="';
if (isset($_SESSION['userFname'][$i])) {
echo $_SESSION['userFname'][$i];
}
echo '"/><br/>';
echo '<label for="userLname[]" class="register">Last Name: </label><input type="text" id="lname'.$i.'" name="userLname[]" class="textbox booking required" value="';
if (isset($_SESSION['userLname'][$i])) {
echo $_SESSION['userLname'][$i];
}
echo '"/><br/>';
echo '<label for="userEmail[]" class="register">E-mail Address: </label><input type="email" id="email'.$i.'" name="userEmail[]" class="textbox booking required" value="';
if (isset($_SESSION['userEmail'][$i])) {
echo $_SESSION['userEmail'][$i];
}
echo '"/><br/>';
echo '<label for="userTel[]" class="register">Telephone: </label><input type="text" id="tel'.$i.'" name="userTel[]" class="textbox booking required" value="';
if (isset($_SESSION['userTel'][$i])) {
echo $_SESSION['userTel'][$i];
}
echo '"/><br/>';
echo '</fieldset>';
}
echo '<input class="button button-alt" type="submit" name="submit" value="Next >"/></form>';
}
?>
</div>
IE11中导致此问题的原因是什么?这两个不匹配的标签(看起来与我匹配)是否足以使整个页面成为空白?
答案 0 :(得分:0)
应该是这样的;在关闭表单之前,请不要关闭您正在启动表单的元素。
<form id="buy-form" name="details" action="booking3.php" method="post">
<div class="6u">
<fieldset>
<legend>Enter Billing Details</legend>
<label for="first_name" class="register">First Name</label><input type="text" id="fname" name="first_name" class="textbox booking required" size="20" maxlength="20" value="<?php if(isset($_SESSION['first_name'])){echo $_SESSION['first_name'];}?>"/><br/>
<label for="last_name" class="register">Last Name</label><input type="text" id="lname" name="last_name" class="textbox booking required" size="20" maxlength="20" value="<?php if(isset($_SESSION['last_name'])){echo $_SESSION['last_name'];}?>"/><br/>
<label for="email" class="register">E-mail Address</label><input type="email" id="emai" name="email" class="textbox booking required" size="20" maxlength="60" value="<?php if(isset($_SESSION['email'])){echo $_SESSION['email'];}?>"/><br/>
<label for="telephone" class="register">Telephone</label><input type="text" id="tel" name="telephone" class="textbox phonenumber booking required" size="20" maxlength="20" value="<?php if(isset($_SESSION['telephone'])){echo $_SESSION['telephone'];}?>"/><br/>
<label for="address">Billing Address</label><textarea class="order required" name="address"><?php if(isset($_SESSION['address'])){echo $_SESSION['address'];}?></textarea>
</fieldset>
</div>
<?php
if ($_SESSION['userno'] >= 1){ // if more than one user is selected, display text boxes to take extra user details
echo '<div class="6u content content-right">';
if ($_SESSION['userno'] == 1){
echo '<span>Please enter the name, e-mail address and telephone number of your user.</span><br/>';
} else{
echo '<span>Please enter the names, e-mail addresses and telephone numbers of your '.$_SESSION['userno'].' users.';
}
for ($i = 0; $i < $_SESSION['userno']; $i++){ //create textboxes for the appropriate amount of users based on userno selection
echo '<fieldset><legend>User '. ($i+1).'</legend>';
if ($i == 0){
echo '<label class="register">As Billing Details</label><input id="userisbooker" type="checkbox" class="booking"/><br/>';
}
echo '<label for="userFname[]" class="register">First Name: </label><input type="text" id="fname'.$i.'" name="userFname[]" class="textbox booking required" value="'; if(isset($_SESSION['userFname'][$i])){echo $_SESSION['userFname'][$i];} echo'"/><br/>';
echo '<label for="userLname[]" class="register">Last Name: </label><input type="text" id="lname'.$i.'" name="userLname[]" class="textbox booking required" value="'; if(isset($_SESSION['userLname'][$i])){echo $_SESSION['userLname'][$i];} echo'"/><br/>';
echo '<label for="userEmail[]" class="register">E-mail Address: </label><input type="email" id="email'.$i.'" name="userEmail[]" class="textbox booking required" value="'; if(isset($_SESSION['userEmail'][$i])){echo $_SESSION['userEmail'][$i];} echo'"/><br/>';
echo '<label for="userTel[]" class="register">Telephone: </label><input type="text" id="tel'.$i.'" name="userTel[]" class="textbox booking required" value="'; if(isset($_SESSION['userTel'][$i])){echo $_SESSION['userTel'][$i];} echo'"/><br/>';
echo '</fieldset>';
}
echo '<input class="button button-alt" type="submit" name="submit" value="Next >"/>';
echo '</div>';
}
?>
</form>