FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Verifying time in php
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Verifying time in php [message #179376 is a reply to message #179375] Sun, 14 October 2012 10:25 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Sun, 14 Oct 2012 11:45:37 +0200, houghi wrote:

> I have a form that has the following entry fields:
> hours minutes seconds
>
> I need the time in seconds and that works:
> $realtime=$_POST['hours']*3600+$_POST['minutes']*60+$_POST['seconds'];
>
> However people can fill out nothing or they could enter characters
>
> What is the easiest way to verify if what the people filled out is
> correct? I have tried, but I get lost in the if statements.

Verify it is correct in what way?

If you want to record the time the data was entered, it would make more
sense to use the system time, and not collect the data in the form at all.

If you want the user to specify the time that an event happened in the
past, or is to happen in the future, give them a select list with options
of 1-31 for day, Jan-Dec for month, <whatever range suits> for year,
00-23 for hours, 00-59 for mins, 00-59 for seconds. Convert the form data
to an actual timestamp and do whatever validation and verification you
want.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Curl chmod file transfer problem...
Next Topic: test
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 17:04:53 GMT 2024

Total time taken to generate the page: 0.21472 seconds