Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    159
    Thanks
    37
    Thanked 2 Times in 2 Posts

    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

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 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).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •