Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2013, 11:34 AM   PM User | #1
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
need help in creating function for input validation

Hi All,

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.

for example:

PHP Code:
<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'>
my condition are

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,
nani
nani_nisha06 is offline   Reply With Quote
Old 02-24-2013, 04:19 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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).
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:03 AM.


Advertisement
Log in to turn off these ads.