thara Posted April 23, 2012 Share Posted April 23, 2012 Hello.. I have Two HTML form and one is a Check boxes form that enable users to select their category. Then I need to display second form according to the categories they selected in first form. I use this code in first form to validate form submission.. if ( isset( $_POST['category']) && sizeof( $_POST['category']) <= 3) { $category = $_POST['category']; } else { $errors[] = 'Please select atleast 1, not more than 3 categories'; } If errors array is empty I did this.. if ( empty( $errors )) { // If everything's OK $_SESSION = $category; $url = 'http://localhost/lanka_institute/tutorsignup/select_subjects.php? // Define the URL. ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } Can I know and is this correct? I display category list from mysql category table, it has category name and category id this is my html part from first page echo '<td width="50%"><input type="checkbox" name="category[]" vlaue="' . $info['category_id'] . '" /> ' . $info['category_name'] . '</td>'; any help appreciated. Thanks in advance.. Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/ Share on other sites More sharing options...
thara Posted April 23, 2012 Author Share Posted April 23, 2012 Please anybody can help me to fix my problem???? thanks in advance again.. Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/#findComment-1339755 Share on other sites More sharing options...
requinix Posted April 23, 2012 Share Posted April 23, 2012 Not if you can't wait three hours on a Sunday night. Fix what problem? Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/#findComment-1339760 Share on other sites More sharing options...
thara Posted April 23, 2012 Author Share Posted April 23, 2012 in my first form I display category list where user to select category. check boxes i used to each category. so I need to check what are the categories that users selected and they should display in my second form. so please tell me how can do this.. Do you clear my problem? thank you.. Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/#findComment-1339762 Share on other sites More sharing options...
requinix Posted April 23, 2012 Share Posted April 23, 2012 Well, it seems you already know that $_POST["checkbox"] is an array of the checkboxes the user has selected, so... use that to determine what you want to show in the second form. Can you be more specific about what you're not sure how to do? Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/#findComment-1339763 Share on other sites More sharing options...
thara Posted April 23, 2012 Author Share Posted April 23, 2012 Its still problem.. 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. In there, i want to display the categories which user selected from sign_up.php page and also its provide to select subjects according to the categories they have selected. my problem is how can I check what are the categories user have selected and how they display in my second page. category come to first page from my category table. It has category_id and category_name columns. thanks for any help.. Quote Link to comment https://forums.phpfreaks.com/topic/261453-check-box-validating/#findComment-1339768 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.