dadamssg Posted January 19, 2009 Share Posted January 19, 2009 im workin on a form where the user enters some fields and one is the time whitch has a couple radio buttons for checking AM or PM....i have written a code to attemp to add 12 to the hours if PM is selected. the problem...my if statement works too well....even if AM is selected, it automatically adds 12 to the hours....heres the section with the problem if($_POST['sampm'] = 'pm') { $shour = $_POST['shour'] + 12; $_SESSION['starts'] = $_POST['syear']."-".$_POST['smonth']."-".$_POST['sday']."- ".$shour.":".$_POST['sminute'].":00"; } $_SESSION['sampm'] = $_POST['sampm']; $begin = $_POST['smonth']."/".$_POST['sday']."/".$_POST['syear']."   " .$_POST['shour'].":".$_POST['sminute']." " .$_SESSION['sampm']; and this is above it all at the beginning of the script $_SESSION['starts'] = $_POST['syear']."-".$_POST['smonth']."-".$_POST['sday']."- ".$_POST['shour'].":".$_POST['sminute'].":00"; #10 $_SESSION['ends'] = $_POST['eyear']."-".$_POST['emonth']."-".$_POST['eday']."- ".$_POST['ehour'].":".$_POST['eminute'].":00"; this is how its suppose to work...user inputs data in form...gets taken to a table with the data in it for them to check(hence the $begin which displays the date and time they entered in the format i want), then adds to database....im formatting the date to be entered in the database and again to display in table. hope this makes since...PLEASE HELP...this is the last tiny detail i can't GET! Link to comment https://forums.phpfreaks.com/topic/141453-help-with-the-last-part/ Share on other sites More sharing options...
glenelkins Posted January 19, 2009 Share Posted January 19, 2009 hi change this if($_POST['sampm'] = 'pm') to if($_POST['sampm'] == 'pm') Link to comment https://forums.phpfreaks.com/topic/141453-help-with-the-last-part/#findComment-740395 Share on other sites More sharing options...
dadamssg Posted January 19, 2009 Author Share Posted January 19, 2009 I freaking LOVE you glen...ive been working on this script for the past two days....no sleep....and that last part caught me up for a good two hours....im an idiot but you are a genious...THANK YOU, my form is FINALLY COMPLETE Link to comment https://forums.phpfreaks.com/topic/141453-help-with-the-last-part/#findComment-740396 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.