The form pulls up as it is suppose to, what I cannot get it to do is actually update the information. If anyone could take a peek and tell me where I am going wrong I would greatly appreciate it.
Thanks ahead of time!
#This is the update page for the site.
// Set the page title and include the HTML header.
$page_title = 'Update Personal Information';
include_once ('incl/header.html');
session_start(); // Start a session.
// If no user_id variable exists, redirect the user.
if (!isset($_SESSION['user_id'])) {
header ("Location: [url]http://[/url]" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
ob_end_clean();
exit();
} else {
if (isset($_POST['submit'])) { // Handle the form.
require_once ('../mysql_connect.php'); // Connect to the database.
$sql="SELECT * FROM user WHERE user_id={$_SESSION['user_id']}";
$query = "UPDATE user SET location=$location , email=$email, homepage=$homepage, biography=$biography, interests=$interests, occupation=$occupation WHERE user_id={$_SESSION['user_id']}";
$result = @mysql_query ($query); // Run the query.
if (mysql_affected_rows() == 1) { // If it ran OK.
} else { // If it did not run OK.
// Send a message to the error log, if desired.
$message = '<p>Your information could not be changed due to a system error.</p>';
}
mysql_close(); // Close the database connection.
}
} // End of the main Update conditional.
// Form begins here.
<form action="<?php echo $SERVER['PHP_SELF']; ?>" method="post">
<table align=center width=100% border="1" bordercolor="#8080C0">
<tr><td colspan=2 class=title background="img/nav_bg.jpg" align=center valign=middle>
<?php
if (isset($SESSION['user_id'])) {
echo "Update {$_SESSION['username']} Profile";
} else {
echo '';
}
?>
</td></tr>
<tr>
<td>Location:</td>
<td><input type="text" name="location" size="25" maxlength="50" value="<?php if (isset($POST['location'])) echo $POST['location']; ?>" /></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($POST['email'])) echo $POST['email']; ?>" /></td>
</tr>
<tr>
<td height="47">Homepage:</td>
<td><input type="text" name="homepage" size="50" maxlength="50" value="<?php if (isset($POST['homepage'])) echo $POST['homepage']; ?>" /></td>
</tr>
<tr>
<td> Biography:</td>
<td><textarea name="biography" cols="50" rows="15" value="<?php if (isset($POST['biography'])) echo $POST['biography']; ?>" /></textarea>
</td>
</tr>
<tr>
<td> Interests:</td>
<td><textarea name="interests" cols="50" rows="5" value="<?php if (isset($POST['interests'])) echo $POST['interests']; ?>" /></textarea>
</td>
</tr>
<tr>
<td height="47">Occupation:</td>
<td><input type="text" name="homepage" size="50" maxlength="50" value="<?php if (isset($POST['occupation'])) echo $POST['occupation']; ?>" /></td>
</tr>
<tr>
<td colspan=2><div align="center"><input type="submit" name="submit" value="Update" /></div></td>
</tr>
</table>
</form><!-- End of Form -->
<?php // Include the HTML footer file.
include_once ('incl/footer.html');
?>