Please help me with this: been doing this for 2 days and still cannot solve it. it won't update...
I have attached my file:
<?php
include('connect-database.php');
if (isset($_POST['submit']) AND $_POST['submit'] == 'update') {
$error = false;
extract($_POST);
if (empty($full_name)) $error = true;
if (!$error) {
$update = "UPDATE users SET
full_name = '$full_name',
WHERE id=$id
";
mysql_query($update) or die(mysql_error() . "<br><br>" . $update);
$full_name = '';
$message = "Record successfully updated.";
} else {
$message = "There is an error in your entry";
}
} else {
$id = intval(isset($_GET['id']) ? $_GET['id'] : 0);
}
if ($id == 0) {
echo "<div style='margin-bottom:10px'>Invalid ID.</div>";
exit;
}
$query = "SELECT * FROM users WHERE id=$id";
$result = mysql_query($query) or die(mysql_error() . "<br><br>" . $query);
if (mysql_num_rows($result) == 0) {
echo "<div style='margin-bottom:10px'>Record Not Found in Database!</div>";
exit;
}
$row = mysql_fetch_array($result);
extract($row);
?>
<div id="mainContent" class="tab_container">
<div id="tab1" class="tab_content">
<h1>Edit Personal Data</h1>
<div style="color:red;font-weight:bold"><? echo $message; ?></div>
<form name="submit" action="" method="post">
<ul>
<li><b>ID # :</b> <?php echo $id?></li>
<li><b>Name :</b> <input type="text" name="full_name" id="" size="30" value="<?php echo $full_name ?>" /></li>
<li><b>Address :</b> <input type="text" name="address" id="" size="55" maxlength="100" value="<?php echo $address ?>" /></li>
<li><b>Contact Number :</b> <input type="text" name="contact_number" id="" size="11" value="<?php echo $contact_number ?>" /></li>
<li><b>Email Address :</b> <input type="text" name="user_email" id="" size="30" value="<?php echo $user_email ?>" /></li>
<li><b>Status :</b> <input type="text" name="status" id="" size="10" value="<?php echo $status ?>" /></li>
<li><b>Nationality :</b> <input type="text" name="nationality" id="" size="20" value="<?php echo $nationality ?>" /></li>
<li><b>Religion :</b> <input type="text" name="religion" id="" size="20" value="<?php echo $religion ?>" /></li>
</ul>
<h2>Self Description</h2>
<p><textarea rows="9" cols="40" name="self_description" ><?php echo $self_description ?></textarea></p>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" name="submit" value="update" />
</form>
</div>
[attachment deleted by admin]