Passing variables across a multi page form in php
- by Chris
Forgive me as I am a newbie. I have a multi page form in which I am using $_SESSIONS to record the variables.
<?php
session_start();
foreach ( $_POST as $key=>$value ) {
if ( $key!="submit" ) {
$value= htmlentities(stripslashes(strip_tags($value)));
$_SESSION[$key] = $value;
}
}`
I have two problems actually. When I get to a checkform.php that I made that prints out the variables, The variables from page 1 doesn't show up even though that code listed above is on each page. I am using Firefox web developers tool to disable cookies and in the php ini, I altered session.use_trans_sid to 1 to turn it on. For the final page on my checkform.php I print_r($_POST) for the final page which works fine. Why doesn't variables from page 1 not show up? What am I missing?
The 2nd problem is that when I print_r($_SESSION), some fields, specifically the checkbox arrays, print as
[payment] => Array
[agerange] => Array
[meals] => Array
[mealtypes] => Array
What am I missing?