graham23s Posted December 15, 2007 Share Posted December 15, 2007 Hi Guys, on my registration form i have this: echo ("<tr>"); echo ("<td align=\"right\"><b>Date Of Birth:</b></td><td align=\"left\"><select name=\"month\"><option value=\"0\">-------</option>"); foreach($months_list as $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo ("</select>"); echo ("<select name=\"day\"><option value=\"0\">--</option>"); foreach($days as $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo ("</select>"); echo ("<select name=\"year\"><option value=\"0\">----</option>"); foreach($years as $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo ("</select><span class=\"star\">*</span></td>"); echo ("</tr>"); which works fine (looks wise) if the user doesn't select any of the 3 fields it's left as: 0 when i process the data i did: <?php ## dob fields filled in if(($month == 0) || ($day == 0) || ($year == 0)) { stderr("Error","Your date of birth details aren't filled in correctly please fill them all in."); include("includes/footer.php"); exit; } ?> so if any of the 3 fields weren't set display an error, but when i fill them in properly i still get the error, any ideas on my logic it looks ok i think lol cheers guys Graham Quote Link to comment Share on other sites More sharing options...
High_-_Tek Posted December 15, 2007 Share Posted December 15, 2007 Well it looks like you have coded your script for if 'register_globals' is turned on, and its better for you to code your script using the superglobals $_POST or $_GET You could re-code your script as: if (empty($_POST['month']) || empty($_POST[['day']) || empty($_POST['year'])) (Of course replace the $_POST with $_GET if your form uses GET 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.