you will have to do validation and play with the script to get it how you want but the basic concept is
[php]
//$user_id needs to be set, you probably have it in a session variable
$user_id… need this
//checks if form has been submitted
if(isset($_POST[‘fname’])) {
//if form submitted then get POST data
$fname = $_POST[‘fname’];
$lname = $_POST[‘lname’];
$dob = $_POST[‘dob’];
$email = $_POST[‘email’];
$pwd = $_POST[‘pwd’];
$addr = $_POST[‘addr’];
//connect to database
$dbhost = “…”; //hostname
$dbuser = “…”; //username
$dbpass = “…”; //password
$dbname = “…”; //database name
$dbconnection=mysql_connect($dbhost, $dbuser, $dbpass);
$db_selected=mysql_select_db($dbname, $dbconnection);
//update the records
$result=mysql_query(“UPDATE user SET fname = ‘$fname’, lname = ‘$lname’, dob = ‘$dob’, email = ‘$email’, pwd = ‘$pwd’, addr = ‘$addr’ WHERE uid = ‘$user_id’”);
} else {
//if the form has not been submitted then output the form
$dbhost = “…”; //hostname
$dbuser = “…”; //username
$dbpass = “…”; //password
$dbname = “…”; //database name
$dbconnection=mysql_connect($dbhost, $dbuser, $dbpass);
$db_selected=mysql_select_db($dbname, $dbconnection);
//get the current information for this user
$result=mysql_query(“SELECT * FROM user WHERE uid = ‘$user_id’”);
$row = mysql_fetch_array($result);
//set the information in variables
$fname = $row[‘fname’];
$lname = $row[‘lname’];
$dob = $row[‘dob’];
$email = $row[‘email’];
$pwd = $row[‘pwd’];
$addr = $row[‘addr’];
//output the form with the users information as the default values in the textbox
echo "
First Name:
Last Name:
Date of Birth:
Email:
Password:
Address:
";
}
[/php]