Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-24-2013, 11:34 AM #1
- Join Date
- Oct 2012
- mother land --india
- Thanked 2 Times in 2 Posts
need help in creating function for input validation
I am here today to learn on creating check function for validation.
in the above scenario i have below requirements to be fulfilled.
I have a form with 4 fields for input type they can take date + time.
my basic need is a server side function while loading values in to db.
<input type='datetime' name='date1[<?=$type?>]' size='18'>
<input type='datetime' name=date2[<?=$itype?>]' size='18'>
<input type='datetime' name='date3[<?=$type?>]' size='18'>
<input type='datetime' name='date4[<?=$type?>]' size='18'>
a) I need function to check whether date2 is greater then date1, date3 is greater then date2, date4 is greater then date3.
2) User will not submit all values at once. Let say if I submit date1 value to db today he may submit another value after week in to the db.
I need your help to solve my above need as i am newbie I need some basic code to expand or extend same.
Thanks & Regards,
02-24-2013, 04:19 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
For a, you need to tell us "which" date2 and date1, date3, etc are being compared. You are issuing arrays for these; do you want to compare each level of the array by key?
For 2, that's of no relevance. The only thing that changes is you need to determine if data was entered prior to operating on it, otherwise it will always be < any real value unless the value is 0 (null = 0).
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');