bigbenbuilders Posted August 18, 2009 Share Posted August 18, 2009 this displays great but what code would I have to put in for the person to edit their profile? I am realy new to this so any help would be wonderful. <?php require_once('auth.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Member Index</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1> <a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a> <p><?php echo $_SESSION['SESS_FIRST_NAME'];?><?php echo $_SESSION['SESS_MIDDLE_NAME'];?><?php echo $_SESSION['SESS_LAST_NAME'];?> </p> <p><?php echo $_SESSION['SESS_PHONE_NAME'];?></p> <p><?php echo $_SESSION['SESS_EMAIL_NAME'];?></p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/170818-solved-realy-new-to-php-how-do-i-get-to-edit/ Share on other sites More sharing options...
kickstart Posted August 18, 2009 Share Posted August 18, 2009 Hi Suspect you would be best finding a php tutorial. Basics though, you put your data out in an HTML form, each field in a an editable input box. When the form is submitted you return to your script, check that the submit button was pressed, validate the fields and then update your session fields. Quick example knocked up. Might well be a few typos, but to give you an idea. <?php require_once('auth.php'); if ($_REQUEST['Save']) { $error = false; if ($_REQUEST['SESS_FIRST_NAME'] == '') { $error = true; } if ($_REQUEST['SESS_MIDDLE_NAME'] == '') { $error = true; } if ($_REQUEST['SESS_LAST_NAME'] == '') { $error = true; } if ($_REQUEST['SESS_PHONE_NAME'] == '') { $error = true; } if ($_REQUEST['SESS_EMAIL_NAME'] == '') { $error = true; } if (!$error) { $_SESSION['SESS_FIRST_NAME'] = $_REQUEST['SESS_FIRST_NAME']; $_SESSION['SESS_MIDDLE_NAME'] = $_REQUEST['SESS_MIDDLE_NAME']; $_SESSION['SESS_LAST_NAME'] = $_REQUEST['SESS_LAST_NAME']; $_SESSION['SESS_PHONE_NAME'] = $_REQUEST['SESS_PHONE_NAME']; $_SESSION['SESS_EMAIL_NAME'] = $_REQUEST['SESS_EMAIL_NAME']; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Member Index</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1> <a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a> <form> <p><input type='text' name='SESS_FIRST_NAME' value='<?php echo $_SESSION['SESS_FIRST_NAME'];?>' /> <input type='text' name='SESS_MIDDLE_NAME' value='<?php echo $_SESSION['SESS_MIDDLE_NAME'];?>' /> <input type='text' name='SESS_LAST_NAME' value='<?php echo $_SESSION['SESS_LAST_NAME'];?>' /> </p> <p><input type='text' name='SESS_PHONE_NAME' value='<?php echo $_SESSION['SESS_PHONE_NAME'];?>' /></p> <p><input type='text' name='SESS_EMAIL_NAME' value='<?php echo $_SESSION['SESS_EMAIL_NAME'];?>' /></p> <input type='submit' name='Save' value='Save' /> </form> </body> </html> You would be best to do rather more validation on the input fields rather than just checking none are blank. All the best Keith Link to comment https://forums.phpfreaks.com/topic/170818-solved-realy-new-to-php-how-do-i-get-to-edit/#findComment-900854 Share on other sites More sharing options...
bigbenbuilders Posted August 18, 2009 Author Share Posted August 18, 2009 keith that worked great thank you so much Link to comment https://forums.phpfreaks.com/topic/170818-solved-realy-new-to-php-how-do-i-get-to-edit/#findComment-900856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.