Jump to content

help with the LAST part


dadamssg

Recommended Posts

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']."&nbsp&nbsp&nbsp" .$_POST['shour'].":".$_POST['sminute']."&nbsp" .$_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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.