View Single Post
Old 07-10-2012, 09:45 PM   PM User | #9
mathruD
New Coder

 
Join Date: Apr 2011
Posts: 45
Thanks: 6
Thanked 0 Times in 0 Posts
mathruD is an unknown quantity at this point
Quote:
Originally Posted by Keleth View Post
Well, as I just told ya how to start a session, that plus googling "php session tutorial" should get you well under way

And the $_SESSION superglobal is like any other variable, just one that can be accessed on any page.

I've tried google for days now. I'm just a bit confused as to exactly what it is I'm doing. I tried a simple test to see if I'm doing it right, but I must not be, as I lost everything on refresh again. I made a simple form:

Code:
<form action="testFormTransferResults.php" method="post" name="form1">
<input name="name1" id="name1" type="text" size="32" />
<input name="name2" id="name2" type="text" size="32" />
<input name="name3" id="name3" type="text" size="32" />
<input name="name4" id="name4" type="text" size="32" />
<input name="name5" id="name5" type="text" size="32" />
<input name="Submit" type="submit" value="Submit" />
</form>
and then sent it to a page with the following code, in which i tried to set a SESSION, but it isn't working (i included session_start() at the top of the page even though it isn't shown here). i have no clue what i'm doing wrong. it echoes fine the first time, but i still lose everything on refresh. Is this even on the right track?

PHP Code:
<?php for($i 1$i 6$i++) {
    
    
$_SESSION['storeName'][$i] = $_POST["name$i"];
    
    echo 
"Name ".$i." is ".$_SESSION['storeName'][$i]."<br />";

?>
mathruD is offline   Reply With Quote