Jump to content

Handling Errors on 1 form, posting them to another?


mjcunnin

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!
<?php

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


if(strlen($_POST['name']) > 0){
$name = TRUE;
}else{
$name = FALSE;
$message1 .= '<p>Please enter your name!</p>';
}
if(is_numeric($_POST['age'])){
$age = TRUE;
}else{
$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'];
}else{

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.