uisneach Posted October 15, 2008 Share Posted October 15, 2008 Hello everybody Got this script connected to a form in a previos file. Like you understand, got the values froma drop down menu here it is: inthe first file. php named Insert.php <select name='month'> <option value='10'>october</option> <option value='11'>november</option> <option value='12'>december</option> </select>"; <select name='day'> <option value='01'>1</option> <option value='02'>2</option> <option value='03'>3</option> (......) <option value='29'>29</option> <option value='30'>30</option> <option value='31'>31</option> </select>"; In the second file .php named form.php got this (retrieve the values) $day= $_POST['day']; $month = $_POST['month']; $year= $_POST['year']; if ($day= "31" and $month = "11"){ echo "<p>The day does not exist!! die(); } else { } And here I will have all the script with query in db, etcc..etcc... THE problem is that also entering other days different from 31st november, (that does not exists), I got the same message and the correct values (like e.g. 1st october, or 20 november. etc...) are considered like being 31st of november. and everything is stopped there , and die ??? anyoine has aclue/idea/advice/suggestion? thx in advance Quote Link to comment https://forums.phpfreaks.com/topic/128519-solved-day-and-month-control-itsnot-working/ Share on other sites More sharing options...
Andy17 Posted October 15, 2008 Share Posted October 15, 2008 Change: if ($day= "31" and $month = "11"){ To: if ($day == 31 && $month == 11){ I guess you got the AND from MySQL syntax. Also remember that when comparing a variable (or whatever it's called) like you do in your if-sentence, you must use double comparison operators (==, && for example). Also, in the next line, remember to close the <p> you open. Quote Link to comment https://forums.phpfreaks.com/topic/128519-solved-day-and-month-control-itsnot-working/#findComment-666028 Share on other sites More sharing options...
uisneach Posted October 15, 2008 Author Share Posted October 15, 2008 Thx a lot andy it's cool now. the problem is solved yes, i got "influence" from mysql syntax. It's a bit tricky for a beginner like me not to be cheated by this stuff cheers Quote Link to comment https://forums.phpfreaks.com/topic/128519-solved-day-and-month-control-itsnot-working/#findComment-666030 Share on other sites More sharing options...
Andy17 Posted October 15, 2008 Share Posted October 15, 2008 Haha yeah, I feel ya. Please click the "Topic solved" text down to the left to mark this topic as solved. Thank you and good luck! Quote Link to comment https://forums.phpfreaks.com/topic/128519-solved-day-and-month-control-itsnot-working/#findComment-666033 Share on other sites More sharing options...
uisneach Posted October 15, 2008 Author Share Posted October 15, 2008 yeah...it's true i forgot it sorry I got to study a loadz of thing bye. thx Quote Link to comment https://forums.phpfreaks.com/topic/128519-solved-day-and-month-control-itsnot-working/#findComment-666037 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.