thara Posted April 23, 2012 Share Posted April 23, 2012 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 https://forums.phpfreaks.com/topic/261483-not-display-my-error-message/ Share on other sites More sharing options...
Jessica Posted April 23, 2012 Share Posted April 23, 2012 If you have an array you cannot just echo it. You need to loop through it, probably using foreach(). For quick debugging you can use print_r() or var_dump(). Link to comment https://forums.phpfreaks.com/topic/261483-not-display-my-error-message/#findComment-1339904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.