On 13 Jun,2003 at 10:26 David Shugarts wrote:
> PHP--I need the user to be able to input a time, then validate it as to
> whether it is complete (e.g., expresses AM or PM and evaluates correctly),
> then pass it into an INSERT statement into the time field of a database.
How about using a radio button for the AM / PM selection on the form? Then if its PM
you can simply adjust the hour figure accordingly to convert to 24hr (add 12 or
whatever) and then concatenate a string together for the INSERT, eg: HHMMSS.
Validating is just a matter of making sure the numbers are sane....a few if then's
should do the trick. Alternatively use select dropdowns on the form to only allow a
user to choose a valid time. Its up to them to get the RIGHT time, of course !!! If
to validate the numbers before the form is submitted. Personal preference really...
Does this help at all?
e: [EMAIL PROTECTED]
t: 01903 739 997
The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php