Jump to content
Larry Ullman's Book Forums

Recommended Posts

Here I use two php page with two forms. my first form is 'sign_up.php' and second is select_subject.php'. sign_up.php page has more categories and users can select up to 3 more categories there. So. after selecting and user click the continue bottom, page want to go to second form page its select_subject.php page.

 

If a user not select a category of who selected over 3 category I need to display a error message. like this "Please select atleast 1, not more than 3 categories."

 

I use this HTML my first page

 

<form method="post" action="select_subject.php"> <my select boxes> </form>

 

 

 

Then I process it in my second page and if user have made a mistake in first page I need to redirect to the first page again with relevant error message. So I use this code in my second page.

 

} else { // No valid ID, kill the script.

 $_SESSION['errors'] = "Please select atleast 1, not more than 3 categories.";
 $url = 'http://localhost/lanka_institute/tutorsignup/tutor_registration.php'; // Define the URL: 
 ob_end_clean(); // Delete the buffer.
 header("Location: $url");
 exit(); // Quit the script.
}

 

 

and my first page I use this

 

if (isset($_SESSION['errors'])) {

 echo '<p> ' . $_SESSION['errors'] . '</p>';

}
unset($_SESSION['errors']);

 

 

but it is not printing my error message in the first page that Im expecting. But it printing 'Array' instead of my message.

 

can you help me, what is the mistake that I have done???

 

thanks in advance.

Link to comment
Share on other sites

 Share

×
×
  • Create New...