为了简短起见:
我有一个单选按钮,但是当我提交表单时,它会给我以下通知:
注意:未定义索引:第 87 行 C:\xampp\htdocs\FDPW... 中的education_check
更多细节:
我有一个表单,其中有以下单选按钮:
<div class="span11">
<h3>A.Education and Professional Qualifications Check:</h3>
<div class="span6">
Education Checked?
</div>
<label class="radio">
<input id="education_check" name="education_check" value="1" type="radio" <?php if(isset($_POST["education_check"])){ if($_POST["education_chec"]== "1"){ echo "checked"; }} ?> class="span1"> Yes
</label>
<label class="radio">
<input id="education_check" name="education_check" value="0" type="radio" <?php if(isset($_POST["education_check"])){ if($_POST["education_check"]== "0"){ echo "checked"; }} ?> class="span1"> No
</label>
</div>
当我提交我的代码时,我有以下调用:
if(isset($_POST["submits"])) {
$Message = helperFunctions::UpdateTableHrForms($id, $_POST["dob_city"], $_POST["dob_province"], $_POST["dob_country"],$_POST["education_check"]);
$_POST["submits"] = null;
echo $Message;
}
这是我在助手中的功能:
public static function UpdateTableHrForms(
$id,$dob_city,$dob_province,$dob_country,$education_check)
{
$conn = new mysqlcon();
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = "INSERT into `hr_forms` (`id`,`dob_city`,`dob_province`,`dob_country`,`education_check`)VLUES (:id,:dob_city,:dob_province,:dob_country,:education_check)";
try {
if (helperFunctions::CheckIDExistHrForms($id) == 0) {
$result = $conn->prepare($query);
$result->execute(array('id'=>$id,'dob_city'=>$dob_city,'dob_province'=>$dob_province,'dob_country'=>$dob_country,'education_check'=>$education_check));
$Msg = "<div style=\"text-align:center;\" class=\"alert alert-success\">
<strong>Tips! </strong>
Data is successfully saved to database.
<button class=\"close\" data-dismiss=\"alert\" type=\"button\">×</button>
</div>";
} else {
$Msg = "<div style=\"text-align:center;\" class=\"alert alert-error\">
<strong>Error! </strong>
This employee's information is already existed in the system.
<button class=\"close\" data-dismiss=\"alert\" type=\"button\">×</button>
</div>";
}
} catch (Exception $e) {
$e->getMessage();
$Msg = $e; /* "<div style=\"text-align:center;\" class=\"alert alert-error\">
<strong>Error! </strong>
This associate information cannot save in the system.
<button class=\"close\" data-dismiss=\"alert\" type=\"button\">×</button>
</div>"; */
}
return $Msg;
}
但一直给我以下通知:
注意:未定义索引:第 87 行 C:\xampp\htdocs\FDPW... 中的education_check