我有一個表格是這樣的:登記表使用數組但在表單值未提交
<form class="registration-form" name="applicationForm" action="<?=$_SERVER['PHP_SELF']?>" method="get">
<div class="form-top"><h3 class="col-md-12 col-md-offset-4">Application for employment</h3> </div>
<div class="col-md-12 col-sm-12 col-lg-6">
<div class="col-md-12">
<div class="form-group">
<label for="inputFirstName">First Name</label>
<input type="text" class="form-control required" id="inputFirstName" placeholder="First Name" name="driver[first_name]" />
</div>
<div class="form-group">
<label for="inputMiddle">Middle Initial</label>
<input type="text" class="form-control" id="inputMiddle" placeholder="Middle Initial" name="driver[middle]" />
</div>
<div class="form-group">
<label for="inputLastName">Last Name</label>
<input type="email" class="form-control required" id="inputLastName" placeholder="Last Name" name="driver[last_name]" />
</div>
<div class="form-group">
<label for="inputDob">Date of Birth</label>
<input type="email" class="form-control required datepicker" id="inputDob" placeholder="MM/DD/YYYY" name="driver[dob]" />
</div>
但是當我嘗試打提交按鈕後顯示的值,也不會提交和將不顯示值。我有這樣的事情顯示的值:
$form_names = array_keys($_GET);
$form_values = array_values($_GET);
if(isset($_GET["submit"]))
{
echo "<h3>Your Input:</h3>";
for ($i = 0; $i < sizeof($_GET); $i++) {
echo "<p>".$form_names[$i]." = " . $form_values[$i] . "</p>";
}
}
請告訴我什麼是丟失或錯誤的東西在我的代碼,因爲它不會提交併顯示值。它在註冊後也不會發送電子郵件。
好這永遠不會發生'如果(isset($ _ GET [ 「提交」])){...}'你似乎沒有結束''標籤。 *「我有一個這樣的表格:」* - 你是什麼意思「像這樣」。類似的東西,還是那個? –
*「註冊後它也不會發送電子郵件。」* - 在您的發佈代碼中沒有看到任何郵件功能。 –
然後姓氏和DOB是'電子郵件'類型。代碼中的錯誤太多。 –