php - Why can't I update my database when I submit a form? -


<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"/> 

this code of form. there wrong?

<?php  if(isset($_post['submitbtn'])) {    if(!$con)  {     die("cannot connect : " .mysql_error());   }   $sql = ("insert leave(leave_start,leave_end,leave_reason)    values('$_post[leave_start]','$_post[leave_end]','$_post[reason]')");   mysql_query($sql,$con);    mysql_close($con); } ?>   

the above php code. when try submitting form database won't update, can me?

did forget include mysql_connect around line 5 of php code?

$con = mysql_connect('mysql_host', 'mysql_user', 'mysql_password'); 

Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -