Bluehost.com Web Hosting $6.95

form validation using php

This is a discussion on form validation using php within the PHP General forums, part of the PHP Programming Forums category; hi i need to validate a field in a form where a user enters their lodgement number as part of ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-14-2008
Sudhakar
 
Posts: n/a
Default form validation using php

hi

i need to validate a field in a form where a user enters their lodgement
number as part of a registration form. this lodgement number can have
letters, numbers, spaces and special characters. i do not know exactly what
those special characters are, so do i have to define the type of special
characters and validate accordingly.

presently my php code for validating the lodgement number is

$lodgementtf = $_POST["lodgementtf"];

if($lodgementtf == "" || !preg_match("/^[a-zA-Z0-9_ <]+$/", $lodgementtf) )

{
echo "display error message":
}

i also have another way of validating

if($lodgementnumber == "" || !preg_match("/^[a-zA-Z0-9_ !-@£$%^&*()]+$/",
$lodgementnumber) )

does this mean that the special characters can only be = a space AND
_!-@£$%^&*() and no other special characters.

please advice.

thanks.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:25 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0