Jump to content


This topic is now archived and is closed to further replies.


Handling Errors on 1 form, posting them to another?

Recommended Posts

Basically what I have to do is an exercise on how to pass data between multiple forms using hidden variables. After the data is entered and you submit it, it sends everything to the second form, where I have the validation taking place. Then the error messages from the last page are posted to this page. I was wondering, is there a way or a function that lets you go back to the previous page and print the error messages there without having to use the "back" key on ur browser?

This is the validation I have on the 2nd page. Thanks for any and all help!

$name = $_POST['name'];
$age = $_POST['age'];

if(strlen($_POST['name']) > 0){
$name = TRUE;
$name = FALSE;
$message1 .= '<p>Please enter your name!</p>';
$age = TRUE;
$age = FALSE;
$message1 .= '<p>Please enter your age!</p>';
if(isset ($message1)){
echo '<font color="red">', $message1,'</font>';
if($name && $age){

$name = $_POST['name'];
$age = $_POST['age'];

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.