Quote:
Originally Posted by Keleth
Well, your use is dead on, so you're on the right track.
You're positive that session_start() is the first line of your code right? Above the HTML, above everything else. The only thing acceptable above it is the PHP open tag
If you have all that, show your full code with the session code actually in there. Remember, if you don't show us, we can only assume you don't know/didn't try.
|
Here is the code for the form:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<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>
</body>
</html>
and here is the code for processing the form and attempting to store the values in a SESSION:
PHP Code:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php for($i = 1; $i < 6; $i++) {
$_SESSION['storeName'][$i] = $_POST["name$i"];
echo "Name ".$i." is ".$_SESSION['storeName'][$i]."<br />";
} ?>
</body>
</html>
It's echoing out the SESSION variables just fine the first time, but refresh causes everything to be lost again. Thanks for continuing to help with this.