I have an online form that each 3 separate options for hour (dtHour), minute (dtMin) and am/pm (dtAP).
dtHour only goes 1-12. dtMin goes 00-55 in 5 increments. dtAP only has am & pm as options.
As each person submits their time, it goes into the database as the 24 hour time. But it shows up on the page as 12 hour format with am/pm.
However, when I choose 12, 00 and pm, the time shows up on the page as 5:59 pm. If I choose 12, 00 and am, the time shows up as 12:00 pm. The minute doesn't seem to be affected at all. It's just the hour.
Below is the code that I am using in the form and in the PHP (both of them are PHP files).
PHP Code:print "<select name=\"dtAP\">\n";
print "<option value=\"0\">am</option>\n";
print "<option value=\"12\">pm</option>\n";
print "</select>\n";
I thought about just making the dtHour drop down option all 24 hour and just get rid of the am/pm but secretaries will be using this it deals with classes so I'd rather not mess with what they're used to; i.e. knowing the 12:30 pm class is cancelled. I'm sure I'll hear it if I do. They have a workaround by choosing 12, 30, and am to make a class be 12:30 pm but that's just confusing.PHP Code:$classTime = $_POST['dtHour'] + $_POST['dtAP'] . ":" . $_POST['dtMin'] . ":00";
I'm not sure what else I need to provide for you to get a good grip on the code. It's just the 12 option in dtHour that seems to be messing up the am/pm options.
Any suggestions?





Reply With Quote

Bookmarks