I m trying to insert user's check in value into db. For this i call the function and set the hidden field's value and than trying to submit the form but here after the form is submiteed hiden field's value is reset .
HTML Code
<form name="checkinout" action="logindetails.php" method="post" enctype="multipart/form-data" id="checkinout">
<table class="login-detaills" width="100%"><thead><th></th><th>Check In</th><th>Check Out</th><th>Hours</th></thead>
<tr><td></td><td></td><td></td><td></td></tr>
</table>
</fieldset>
<table>
<tr><td><input type="button" onClick="call()" value="checkin"></button></td><td><input type="button" id="logout" onclick="call2();" value="Check Out" ></td></tr>
<tr><td><input type="hidden" id="checkin" name="checkin"></td><td><input type="hidden" id="checkout" name="checkout"></td></tr>
</table>
</form>
Javascript
function call(){
$('#checkin').val("checkin");
$('#checkinout').submit();
}
function call2(){
$('#checkout').val("checkout");
$('#checkinout').submit();
}
PHP CODE
if(isset($_POST['checkinout']) ){
if(isset($_POST['checkin']) && $_POST['checkin']=='checkin'){
$sql = "INSERT INTO attend (loginout,log_type,fk_userid) VALUES ('".TODAY_DATETIME."','I','".$_SEESION['user_id']."')";
}elseif(isset($_POST['checkout']) && $_POST['checkout']=='checkout'){
$sql = "INSERT INTO attend (loginout,log_type,fk_userid) VALUES ('".TODAY_DATETIME."','O','".$_SEESION['user_id']."')";
}
$stmt = $class->dbh->prepare($sql);
$stmt->execute();
$res = $stmt->fetch(PDO::FETCH_ASSOC);
}
first of all its not satisfied this if(isset($_POST['checkinout'])