drumhrd Posted June 22, 2009 Share Posted June 22, 2009 Hello, I am sure this is simple. I just need to know the most efficent way to get form data (from user) and store it in the $_SESSION[] array so I can pass data between pages. using forms input type text and also using text area for larger entries. would something like this work? <input name="test" type="text" value="<? $_SESSION[test]?>"> Quote Link to comment https://forums.phpfreaks.com/topic/163187-solved-form-info-to-session-variable/ Share on other sites More sharing options...
joel24 Posted June 22, 2009 Share Posted June 22, 2009 that would work for calling it... but to store the form data in the session you'd have to have that form post to whatever page.. or itself and then have session_start(); $_SESSION['test'] = $_POST['test']; etc etc Quote Link to comment https://forums.phpfreaks.com/topic/163187-solved-form-info-to-session-variable/#findComment-860984 Share on other sites More sharing options...
drumhrd Posted June 22, 2009 Author Share Posted June 22, 2009 so...I'd have to do something like below. page 1 session_start(); $_SESSION['test'] = $_POST['test']; $_SESSION['test2'] = $_POST['test2']; then <form id="test" method="post" action="page2.php"> <input type="text" name="test" id="test"> <br /> input type="text" name="test2" id=test2"> </form> so then on page2.php..I could do session_start(); echo $_SESSION['test2'] . " " . $_SESSION['test'] ; Quote Link to comment https://forums.phpfreaks.com/topic/163187-solved-form-info-to-session-variable/#findComment-860993 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.