Matthew Herren Posted October 3, 2009 Share Posted October 3, 2009 Ok i'm trying to create a page after a form is submitted so the user can review and edit their posted variables. I'm not sure about the best way to do this but i'm trying to save them in a session then echo them. Like This: <php /session start session_start(); // variables session_register('name'); session_register('last'); session_register('mi'); session_register('hp'); session_register('cp'); session_register('work'); session_register('email'); session_register('add'); session_register('add2'); session_register('city'); session_register('state'); session_register('zip'); session_register('password'); //finally, let's store our posted values in the session variables $_SESSION['name'] = $_POST['name']; $_SESSION['last'] = $_POST['last']; $_SESSION['mi'] = $_POST['mi']; $_SESSION['hp'] = $_POST['hp']; $_SESSION['cp'] = $_POST['cp']; $_SESSION['work'] = $_POST['work']; $_SESSION['email'] = $_POST['email']; $_SESSION['add'] = $_POST['add']; $_SESSION['add2'] = $_POST['add2']; $_SESSION['city'] = $_POST['city']; $_SESSION['state'] = $_POST['state']; $_SESSION['zip'] = $_POST['zip']; $_SESSION['password'] = $_POST['password']; ?> <HTML> <HEAD> </HEAD> <body> <php echo"$_SESSION['name']"?> </body> </HTML> Is this the best way, or is there a better way?? Quote Link to comment https://forums.phpfreaks.com/topic/176339-echo-_sessionname/ Share on other sites More sharing options...
.josh Posted October 3, 2009 Share Posted October 3, 2009 first off, you do not need to use session_register. In fact, it's already deprecated and being removed as of php6. 2nd...what exactly is your overall goal here? I'm not really seeing the point of having the user enter in editable stuff in a form, only to turn around and let them edit it again... perhaps you can explain what you're trying to do on a more "top" level? Regardless though, what you have is technically right, minus the session_register which technically works but is superfluous and deprecated. edit: oh just noticed also you have the session var wrapped in quotes when you echo it. That is not necessary either. Quote Link to comment https://forums.phpfreaks.com/topic/176339-echo-_sessionname/#findComment-929434 Share on other sites More sharing options...
Matthew Herren Posted October 3, 2009 Author Share Posted October 3, 2009 Once the form is filled out and they hit post. I want to show them all the information they just entered on a page so they can review it, then give them the option to edit it. Quote Link to comment https://forums.phpfreaks.com/topic/176339-echo-_sessionname/#findComment-929436 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.