I am having a problem setting the default values of a form to the values in a table. I want to recall the current user’s values and allow the user to edit them. Can someone please help?
My code is as follows:
<?php session_start(); if (!isset($_SESSION['user'])) { header("Location: login.php"); } include ('dbc.php'); if ($_POST['Submit']=='Change') { $rsPwd = mysql_query("select user_pwd from users where user_email='$_SESSION[user]'") or die(mysql_error()); mysql_query("Update users SET full_name = '$full_name' WHERE user_email = '$_SESSION[user]' ") or die(mysql_error()); header("Location: settings.php?msg=Settings updated..."); } ?> <?php $result = mysql_query ("SELECT * FROM users WHERE user_email LIKE '$_SESSION[user]' "); if ($row = mysql_fetch_array($result)) { do { PRINT "Username: "; print $row["full_name"]; print (" "); print (""); PRINT "Name: "; print $row["user_name"]; print ("
"); PRINT "Email: "; print $row["user_email"]; print ("
"); PRINT "Class: "; print $row["l_class"]; print ("
"); PRINT "Call Sign: "; print $row["call_sign"]; print ("
"); PRINT "Country: "; print $row["country"]; print ("
"); } while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were found!";} ?> <?php if (isset($_GET['msg'])) { echo "
Edit Account for <?php print $_SESSION[user] ?> |
|