<?php
include_once 'dbconnect.php';
if($_SERVER['REQUEST_METHOD']='POST'){
if(isset($_POST['submit']) or !empty($_POST['submit'])){
$id = $_POST['id'];
$name=isset($_POST['name'])?$_POST['name']:NULL;
if(is_null($name) or empty($name)){
header("location:{$_REQUEST['/']}?action=name&msg=blank-name&/=$id");
exit;
}
$email=isset($_POST['email'])?$_POST['email']:NULL;
if(is_null($email) or empty($email)){
header("location:{$_REQUEST['/']}?action=email&msg=blank-email&/=$id");
exit;
}
$mobile=isset($_POST['mobile'])?$_POST['mobile']:NULL;
if(is_null($mobile) or empty($mobile)){
header("location:{$_REQUEST['/']}?action=mobile&msg=blank-mobile&/=$id");
exit;
}
}
$insertquery="update vritant_tbl set name='{$name}',email='{$email}',mobile='{$mobile}' where id='{$id}'";
$iquery =mysqli_query($con,$insertquery);
if($iquery){
?>
<script>
window.alert("update Successfully");
window.location.href="show.php";
</script>
<?php
}else{
?>
<script>
window.alert("Failed");
</script>
<?php
}
}else{
header("location:edit.php?msg=Invalid-Request");
}
?>
0 Comments