簡體   English   中英

PHP表單錯誤僅在Internet Explorer中存在

[英]PHP form error only present in Internet Explorer

我正在使用PHP表單引導我的網站。 http://camp.impactak.com/signup.html )這種形式在Internet Explorer以外的所有瀏覽器中都可以正常使用。 它帶有和錯誤:

“請更正以下錯誤:您的姓名打回上一步按鈕,然后重試。”

我將代碼放入PHP中,如果某些空白沒有填補,它應該消除了一條錯誤消息。 但是,它仍然發送錯誤(僅在IE中)

PHP:

    <?php
/* Set e-mail recipient */
$myemail = "erinpavek@gmail.com";

/* Check all form inputs using check_input function */
$name = check_input($_POST['inputName'], "Your Name");
$address = check_input($_POST['inputAddress'], "Street, PO Box, company");
$address2 = check_input($_POST['inputAddress2'], "Apt, Unit, Suite");
$village = check_input($_POST['inputVillage'], "Your Village");
$state = check_input($_POST['inputState'], "State, Providence, Region");
$zip = check_input($_POST['inputZip'], "Your Zip");
$tel = check_input($_POST['inputTel'], "Your Phone");
$email = check_input($_POST['inputEmail'], "Your E-mail Address");
$pname = check_input($_POST['inputParent'], "Parent/Guardian Name");
$subject = check_input($_POST['inputSubject'], "Message Subject");
$message = check_input($_POST['inputMessage'], "Your Message");
$select = check_input($_POST['inputSelect'], "Certified");
$select2 = check_input($_POST['inputSelect2'], "NonCertified");

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("Invalid e-mail address");
}

/* Let's prepare the message for the e-mail */

$subject = "Someone has sent you a message";

$message = "

Someone has sent you a message using your contac form:

Name: $name

Address: $address
Address2: $address2
Village: $village
State: $state
Zip: $zip

Cell: $tel

Email: $email

Parent/Guardian: $pname

Certified: $select

NonCertified: $select2

Subject: $subject
Message:
$message

";

/* Send the message using mail() function */
mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */
header('Location: http://www.camp.impactak.com');
exit();

/* Functions we used */
function check_input($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
?>

HTML:

    <form name="contactform" method="post" action="mailer.php" class="form-horizontal" role="form">
  <div class="panel-body">

                        <form name="contactform" method="post" action="http://wedding-space.net/01_admin_resources/blog/contact_form/mailer.php" class="form-horizontal" role="form">
                            <div class="form-group">
                                <label for="inputName" class="col-lg-3 control-label">Full Name</label>
                                <div class="col-lg-9">
                                    <input type="text" class="form-control" id="inputName" name="inputName" placeholder="First and Last Name">
                                </div>
                            </div>

                         <div class="form-group">
                                <label for="inputAddress" class="col-lg-3 control-label">Address1</label>
                                <div class="col-lg-9">
                                    <input type="text" class="form-control" id="inputAddress" name="inputAddress" placeholder="Street">
                                </div>
                          </div>

                        <div class="form-group">
                                <label for="inputAddress2" class="col-lg-3 control-label">Address2</label>
                                <div class="col-lg-9">
                                    <input type="text" class="form-control" id="inputAddress2" name="inputAddress2" placeholder="Apt, Unit, Building">
                                </div>
                            </div>

                           <div class="form-group">
                                <label for="inputVillage" class="col-lg-4 control-label">Village</label>
                           <div class="col-lg-8">
                                    <input type="text" class="form-control" id="inputVillage" name="inputVillage" placeholder="Village">
                                </div>
                            </div>

                           <div class="form-group">
                                <label for="inputState" class="col-lg-4 control-label">State</label>
                           <div class="col-lg-8">
                                    <input type="text" class="form-control" id="inputState" name="inputState" placeholder="State">
                                </div>
                        </div>

                           <div class="form-group">
                                <label for="inputZip" class="col-lg-4 control-label">Zip Code</label>
                           <div class="col-lg-8">
                                    <input type="text" class="form-control" id="inputZip" name="inputZip" placeholder="Zip">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputEmail" class="col-lg-3 control-label">Email</label>
                                <div class="col-lg-9">
                                    <input type="text" class="form-control" id="inputEmail" name="inputEmail" placeholder="Your Email">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputParent" class="col-lg-3 control-label">Parent/Guardian</label>
                                <div class="col-lg-9">
                                    <input type="text" class="form-control" id="inputParent" name="inputParent" placeholder="Parent/Guardian Name">
                                </div>
                            </div>



         <h5>Each student much choose one class from the either the Certified or Non-Certified class list:  </h5>                 
                      <select class="form-control" id="inputSelect" name="inputSelect">
<option value="none">Certified Classes</option>
  <option value="DriversEd">Drivers Ed. (get license, village youth only)</option>
  <option value="NSTC">NSTC- (Seniors or 2014 graduates)</option>
  <option value="LifeGuard">Life Guard Training</option>
  <option value="ArcticSurvival">Arctic Survival Certification</option>
</select>    
    <br>
                       <select class="form-control" id="inputSelect2" name="inputSelect2">
<option value="none">Non-Certified Classes</option>
  <option value="cook">Cooking</option>
  <option value="Art">Arts from the Earth/Crafts</option>
  <option value="poetry">Creative Writing/Poetry</option>
  <option value="guitar">Guitar Lessons</option>
  <option value="engineering">Science and Engineering</option>
  <option value="drama">Drama/Acting</option>
  <option value="taeKwonDo">Tae Kwon Do</option>
  <option value="sodHouse">Sod House Design</option>
  <option value="SkinSewing">Skin Sewing</option>
  <option value="DrumDance">Drum Dancing</option>
  <option value="Aviation">Aviation</option>
  <option value="Rap">Rap/Hip-Hop Class</option>
</select>

<br>
                     </form>       
                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button type="submit" class="btn btn-default">
                                        Sign Up
                                    </button>
                                </div>
                            </div>
                        </form>
</div>
                    </div>

答案盯着我們。

您在窗體中放置一個窗體。

那是不允許的。

您不能讓表單提交表單。

請相應地重新調整您的標記,以使表格中沒有表格,盡管它們可能是同級的。 問題解決了。

你有:

<form><form></form></form>

您需要刪除內部表單,或將其分開:

<form></form>

要么

<form></form>
<form></form>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM