<form name="applyform" action="applyform.php" method="post">
<fieldset>
<legend>Application Details</legend>
<p>Name :<?php echo $row ["Emp_Fname"]; ?></p>
<p>ID number :<?php echo $row['Emp_ID']; ?></p>
<p>Email :<?php echo $row['Emp_Email']; ?></p>
<p>Address :<?php echo $row['Emp_Address']; ?></p>
<p>Handphone Number :<?php echo $row['ContactNo_HP']; ?></p>
<p>Phone Number :<?php echo $row['ContactNo_Home']; ?></p>
<p>Date of application :<?php echo $row['Leave_RequestDate']; ?></p>
<p>Type of leave:
<select name="leave type">
<option selected>Annual leave</option>
<option>Sick leave</option>
<option>Emergency leave</option>
<option>Maternity leave</option>
</select>
</p>
<p>Leave duration:<input type="date" name="leave_start">to<input type="date" name="leave_end"></p>
<p>Reason:<textarea rows="4" cols="50" name="reason"></textarea></p>
<p><input type="submit" name="submitbtn" value="Submit"/>
这是我的表格的代码。有什么问题吗?
<?php
if(isset($_POST['submitbtn'])) {
if(!$con) {
die("cannot connect : " .mysql_error());
}
$sql = ("INSERT INTO leave(Leave_Start,Leave_End,Leave_Reason) VALUES('$_POST[leave_start]','$_POST[leave_end]','$_POST[reason]')");
mysql_query($sql,$con);
mysql_close($con);
}
?>
以上是我的PHP代码。当我尝试提交表单时,数据库不会更新,任何人都可以帮助我吗?