<?php include('db.php'); $result = $conn->prepare("SELECT * FROM tbl_member where tbl_member_id='$ID'"); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ $id=$row['tbl_member_id']; ?> <form method="post" action="edit_person_query.php<?php echo '?tbl_member_id='.$id; ?>"> <table border="1" cellspacing="5" cellpadding="5" width="100%"> <tr> <td> </td> <td width="395px"> <input type="text" class="text_Box" name="first_name" value="<?php echo $row['first_name']; ?>" autofocus="autofocus" placeholder="First Name ....." /> </td> </tr> <tr> <td> </td> <td width="395px"> <input type="text" class="text_Box" name="last_name" value="<?php echo $row['last_name']; ?>" placeholder="Last Name ....." /> </td> </tr> <tr> <td> </td> <td width="395px"> <input type="text" class="text_Box" name="contact_number" value="<?php echo $row['contact_number']; ?>" placeholder="Contact Number ....." /> </td> </tr> <tr> <td> </td> <td width="395px"> <input type="email" class="text_Box" name="email" value="<?php echo $row['email']; ?>" placeholder="Email ....."> </td> </tr> <tr> <td> </td> <td width="395px"> <input type="text" class="text_Box" name="address" value="<?php echo $row['address']; ?>" placeholder="Address ....." /> </td> </tr> <tr> <td colspan="2"> <a> <button type="submit" class="btn_confirm"> Save Data </button> </a> </td> </tr> </table> </form> <?php } ?>
<?php include 'db.php'; $get_id=$_REQUEST['tbl_member_id']; $first_name= $_POST['first_name']; $last_name= $_POST['last_name']; $contact_number= $_POST['contact_number']; $email= $_POST['email']; $address= $_POST['address']; $sql = "UPDATE tbl_member SET first_name ='$first_name', last_name ='$last_name', contact_number ='$contact_number', email ='$email', address ='$address' WHERE tbl_member_id = '$get_id' "; echo "<script>alert('Successfully Edit The Account!'); window.location='index.php'</script>"; ?>