edit_accounts.php
<?php $get_id = $_GET['id']; ?>
<?php// $get_id = isset($_POST['id']) ? $_POST['id'] : ''; ?>
<div class="container">
<div class="margin-top">
<div class="row">
<div class="span12">
<?php
$query=mysqli_query($dbcon,"select * from users_tbl where id ='$get_id'")or die(mysqli_error());
$row=mysqli_fetch_array($query);
$id=$row['id'];
?>
<div class="alert alert-info"><i class="icon-pencil"></i> Edit Member</div>
<p><a class="btn btn-info" href="users.php"><i class="icon-arrow-left icon-large"></i> Back</a></p>
<div class="addstudent">
<div class="details">Please Enter Details Below</div>
<form class="form-horizontal" method="POST" action="update_accounts.php" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label" for="inputEmail">User_ID:</label>
<div class="controls">
<input type="text" id="inputEmail" value="<?php echo $row['code'];?>" name="code" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Username:</label>
<div class="controls">
<input type="text" id="inputEmail" name="username" maxlength="30" value="<?php echo $row['username'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Firstname:</label>
<div class="controls">
<input type="text" id="inputPassword" name="firstname" maxlength="30" value="<?php echo $row['firstname'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Middlename:</label>
<div class="controls">
<input type="text" id="inputPassword" name="middlename" maxlength="30" value="<?php echo $row['middlename'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Lastname:</label>
<div class="controls">
<input type="text" id="inputEmail" name="lastname" value="<?php echo $row['lastname'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Email:</label>
<div class="controls">
<input type="email" id="inputEmail" name="email" value="<?php echo $row['email'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Address:</label>
<div class="controls">
<input type="text" id="inputEmail" name="address" value="<?php echo $row['address'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Contact No:</label>
<div class="controls">
<input type="text" id="inputEmail" name="contact_number" maxlength="11" value="<?php echo $row['contact_number'];?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Position:</label>
<div class="controls">
<input type="text" id="inputEmail" name="position" value="<?php echo $row['position'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">User Type:</label>
<div class="controls">
<input type="text" id="inputEmail" name="type_id" value="<?php echo $row['type_id'];?>" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">BirthDate:</label>
<div class="controls">
<input type="date" id="inputEmail" name="birthdate" value="<?php echo $row['birthdate'];?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Date Started:</label>
<div class="controls">
<input type="date" id="inputEmail" name="date_started" value="<?php echo $row['date_started'];?>">
</div>
</div>
<div class="control-group">
<div class="controls">
<button name="submit" type="submit" class="btn btn-success"><i class="icon-save icon-large"></i> Update</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST['submit'])){
$usercode=$_POST['code'];
$username=$_POST['username'];
$firstname=$_POST['firstname'];
$middlename=$_POST['middlename'];
$lastname=$_POST['lastname'];
$type_id=$_POST['type_id'];
$birthdate=$_POST['birthdate'];
$address = $_POST['address'];
$email=$_POST['email'];
$password="qwerty";
$contact_number=$_POST['contact_number'];
$position=$_POST['position'];
$date_started=$_POST=['date_started'];
mysqli_query($dbcon,"UPDATE users_tbl set
code='$usercode',firstname='$firstname',lastname='$lastname',middlename = '$middlename',
lastname = '$lastname',type_id = '$type_id',birthdate = '$birthdate',address = '$address',email = '$email',password = '$password',
contact_number = '$contact_number',position = '$position',date_started = '$date_started' where id='$id'")or die(mysqli_error());
?>
<script>alert('Update Status Successful!');
window.location='accounts.php';</script>;
<?php
}
?>
accounts.php
<thead>
<tr>
<th>User ID:</th>
<th>Username</th>
<th>Firstname</th>
<th>Middlename</th>
<th>Lastname</th>
<th>Email</th>
<th>Address</th>
<th>Contact No.</th>
<th>Position</th>
<th>User Type:</th>
<th>Birthdate:</th>
<th>Date Started</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $user_query=mysqli_query($dbcon,"select * from users_tbl")or die(mysqli_error());
while($row=mysqli_fetch_array($user_query)){
$id=$row['id']; ?>
<tr class="del<?php echo $id ?>">
<td><?php echo $row['code']; ?></td>
<td><?php echo $row['username']; ?></td>
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['middlename']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['contact_number']; ?></td>
<td><?php echo $row['position']; ?></td>
<td><?php echo $row['type_id']; ?></td>
<td><?php echo $row['birthdate']; ?></td>
<td><?php echo $row['date_started']; ?></td>
<td class="action">
<a rel="tooltip" title="Delete" id="<?php echo $id; ?>" href="#delete_book<?php echo $id; ?>" data-toggle="modal" class="btn btn-danger"><i class="icon-trash icon-large"></i></a>
<?php include('delete_book_modal.php'); ?>
<a rel="tooltip" title="Edit" id="<?php echo $id; ?>" href="edit_accounts.php<?php echo '?id='.$id; ?>" class="btn btn-success"><i class="icon-pencil icon-large"></i></a>
</tr>
<?php } ?>
</tbody>
</table>
When I press edit, all information is there and After I click Update the error will show(as you can see in the picture) It's already getting the ID because it will not be show the information if not. And it does not save my update, I change the information but after click the button the information was still the same.