Jump to content

[SOLVED] form info to session variable


drumhrd

Recommended Posts

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]?>">

Link to comment
https://forums.phpfreaks.com/topic/163187-solved-form-info-to-session-variable/
Share on other sites

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'] ;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.