Log in

View Full Version : PHP Successfully validate then pass variables across multiple pages



dissonantallure
08-06-2009, 01:29 AM
Okay I have finally figured out how to pass variables across multiple pages by using the following code.



<?php
foreach ($_POST as $key => $val) {
echo '<input type="hidden" name="' . $key . '" value="' . $val . '" />' . "\r\n";
}
?>



Now I am stuck on how to validate each field without using any JavaScript. I usually use:




<form action="<?php $_SERVER['PHP_SELF'] ?>" />



However, I cannot use that code and pass variables to the next page. Can anyone please help me successfully validate and pass form fields across several pages?

forum_amnesiac
08-06-2009, 12:06 PM
Why not use SESSION variables instead.

This is a fairly easy way of passing variables to multiple pages with no intricate code needed to access the variable values.

Have a look at how to use SESSION variables and see if that meets your requirements