suess0r Posted December 15, 2006 Share Posted December 15, 2006 OK,i have pg1.php which has 3 dropdowns they can choose from with a button 'submit.' I have all of my queries running smoothly and correctly, i'm just having the following problems...1. If they don't select anything and hit submit, it takes them to pg2.php - instead of displaying a message saying "Please select from atleast one of the following options" and not leaving the page.2. If they do choose something and it runs the query and doesn't find anything, it doesn't say "Search Results not found..." ---i tried doing this if outside of my for loop[quote]if (mysql_num_rows > 0) { for ($i = 0; $i < mysql_num_rows($result_set); $i++) { -queries-}} else {echo 'Search Results not found...';[/quote]*but unfortunately this kept returning Search Results not found... no matter what.*hopefully someone can shed some light on these minor 2 problems. thanks!! ;D Quote Link to comment Share on other sites More sharing options...
SharkBait Posted December 15, 2006 Share Posted December 15, 2006 Prior to going to your second page you can try something like:[code]<?php$errMsg = "";//get infor from dropdownif(!empty($_POST['mydropdown'])) { $value1 = $_POST['mydropdown];} else { $errMsg .= "You forgot to select an option";}if($errMsg == "") { // No errors continue to page 2} else { // There were errors display them: echo $errMsg;}?>[/code]If you need more explaination I can do so :) Quote Link to comment Share on other sites More sharing options...
suess0r Posted December 15, 2006 Author Share Posted December 15, 2006 hmm, thanks sharkbait but i'm not POSTing the form to pg1.php i'm sending it to pg2.php where i could check to see if !empty to say that, but is there a way for me to stay in pg1.php to check if it's set on submission and if something is set to move on to pg2 with the post?? thanks for all the help! Quote Link to comment Share on other sites More sharing options...
SharkBait Posted December 15, 2006 Share Posted December 15, 2006 Do you pass the variables via $_GET, $_SESSION, $_COOKIE or another way? Quote Link to comment 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.