12 Replies - 766 Views - Last Post: 22 April 2011 - 03:34 PM Rate Topic: -----

#1 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

forms validation in php

Posted 15 April 2011 - 01:33 AM

i need to implement form validation part in my shopping cart such as email address , age, address and etc.
how to validate email address and other forms ? what are the implicit functions in php for validation?\

thanks in advance,
menuka
Is This A Good Question/Topic? 0
  • +

Replies To: forms validation in php

#2 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

Re: forms validation in php

Posted 15 April 2011 - 01:51 AM

what is header() in PHP?
Was This Post Helpful? 0
  • +
  • -

#3 muaaz007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 16-June 10

Re: forms validation in php

Posted 15 April 2011 - 04:23 AM

It is used to redirect the page from server

if($uid == 1)
{
    header('Location: ' . "http://www.google.com");
}


Always have condition on your redirection must occur as for validation there are two ways server validation and user end validation in which you are interested.

This post has been edited by Dormilich: 15 April 2011 - 04:55 AM
Reason for edit:: please use [code] /* your code source here */ [/code] tags when posting code

Was This Post Helpful? 0
  • +
  • -

#4 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: forms validation in php

Posted 15 April 2011 - 05:42 AM

Validating user input is as easy as using these methods

filter_var along side the filter type constants and also PCRE's function preg_match.
Was This Post Helpful? 2
  • +
  • -

#5 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: forms validation in php

Posted 19 April 2011 - 07:39 AM

View Postmenukadevinda, on 15 April 2011 - 01:33 AM, said:

i need to implement form validation part in my shopping cart such as email address , age, address and etc.
how to validate email address and other forms ? what are the implicit functions in php for validation?\

thanks in advance,
menuka


an easy way to do this would be Javascript to handle the client side validation
Was This Post Helpful? 0
  • +
  • -

#6 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: forms validation in php

Posted 19 April 2011 - 07:41 AM

View PostSadin56, on 19 April 2011 - 10:39 AM, said:

View Postmenukadevinda, on 15 April 2011 - 01:33 AM, said:

i need to implement form validation part in my shopping cart such as email address , age, address and etc.
how to validate email address and other forms ? what are the implicit functions in php for validation?\

thanks in advance,
menuka


an easy way to do this would be Javascript to handle the client side validation


Not all browsers support Javascript so that would open up your PHP script to a whole lot of garbage and useless data.
Was This Post Helpful? 1
  • +
  • -

#7 RPGonzo  Icon User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: forms validation in php

Posted 19 April 2011 - 11:18 AM

Plus validation using Javascript is basically useless. Because it's client side tech the user could simply modify the scripts you sent over to fit their need.

You never trust anything coming from the users end.
Was This Post Helpful? 0
  • +
  • -

#8 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: forms validation in php

Posted 20 April 2011 - 07:10 AM

i see well i actually use AJAX i didnt know javascript was so useless in that area
Was This Post Helpful? 0
  • +
  • -

#9 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 944
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: forms validation in php

Posted 20 April 2011 - 07:24 AM

View PostSadin56, on 20 April 2011 - 10:10 AM, said:

i see well i actually use AJAX i didnt know javascript was so useless in that area


It's not totally useless. You can stop the sending of forms if some fields aren't filled out which can save the server some bandwidth and processing time.
Was This Post Helpful? 0
  • +
  • -

#10 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,204
  • Joined: 19-January 10

Re: forms validation in php

Posted 20 April 2011 - 09:32 AM

It's best to validate forms using PHP.
Was This Post Helpful? 0
  • +
  • -

#11 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: forms validation in php

Posted 21 April 2011 - 07:20 AM

well i meant validate forms being filled out properly on client side i didnt realize you meant validate the user by checking the database and such
Was This Post Helpful? 0
  • +
  • -

#12 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: forms validation in php

Posted 21 April 2011 - 07:28 AM

Input can and should be validated on both sides, IMHO. You can never do too much validation where users are concerned.
Was This Post Helpful? 2
  • +
  • -

#13 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: forms validation in php

Posted 22 April 2011 - 03:34 PM

View PostJackOfAllTrades, on 21 April 2011 - 07:28 AM, said:

Input can and should be validated on both sides, IMHO. You can never do too much validation where users are concerned.


very good point.

actually this is exactly what my current project in PHP is im new to PHP only id say a month under my belt but im confident i can build a nice user login and registration for with validation via Javascript and PHP thanks for sheding some like on this subject for me :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1