Update Profile Script Problems...
Posted: Thu Dec 04, 2003 3:09 pm
I have a script to update my users profile, but it doesn't work. I can't find whats wrong with it. No error message either. When I hit "submit", it just reloads the page.
Here is my code:
Any help is appreciated. Thanks!
Here is my code:
Code: Select all
<?php
if (isSet($_POST['submit'])) {
if (empty($_POST['firstname']) || empty($_POST['lastname']) || empty($_POST['email'])) {
echo "<head><meta http-equiv=refresh content="2;
URL=index.php"></head><b>Login Invalid</b><BR>Please wait. You will be redirected in two seconds.";
die;
} else {
$query = "UPDATE users WHERE username = $username AND password = $password VALUES ('', '', '', '{$_POST['firstname']}', '{$_POST['lastname']}', '{$_POST['email']}', '', '', '', '{$_POST['backcolor']}', '', '', '')";
$result = mysql_query($query) or die(mysql_error);
echo "<head><meta http-equiv=refresh content="2;
URL=index.php"></head><b>Profile Updated.<BR>You will have to log back in.</b><BR>Please wait. You will be redirected in two seconds.";
}
} else {
if ($pref_backcolor == 1) {
$pref_backcolor_white = "selected";
$pref_backcolor_black = "";
} else {
$pref_backcolor_white = "";
$pref_backcolor_black = "selected";
}
echo "<td><div align="$bodyalign">
<form action="{$_SERVER['PHP_SELF']}" method="post">
<table width="0" cellpadding="5" cellspacing="0">
<tr><td>First Name: </td>
<td><input type="text" name="firstname" maxlength="50" value="$firstname"></td></tr>
<tr><td>Last Name: </td>
<td><input type="text" name="lastname" maxlength="50" value="lastname"></td></tr>
<tr><td>Email: </td>
<td><input type="text" name="email" maxlength="150" value="$email"></td></tr>
<tr><td>Backround Color: </td>
<td><select name="backcolor">
<option name="1" $pref_backcolor_white>White</option>
<option name="2" $pref_backcolor_black>Black</option>
</select></td></tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</forum></table></div>
</td>
</table></div>"; }
?>