Quote:
Originally Posted by Keleth
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 />";
} ?>