PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 9th, 2000, 09:58 AM
djmouse djmouse is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 14 djmouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,

I want to validate forms. I want to check the following.
* Has the user given a valid e-mail address?
* remove all leading and trailing spacebar-hits
* Check if only text has been inputted in a textfield
* if a valid date is given
* Check if only numbers have been inputted in an input field
* all other checks I may have left out.

Thanx in advance,
Dj Mouse

Reply With Quote
  #2  
Old May 10th, 2000, 06:12 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

Go and see the form validation article....

http://hotwired.lycos.com/webmonkey...?tw=programming

------------------

SR -
shiju.dreamcenter.net

Web developer from GOD's own country!!!!

Reply With Quote
  #3  
Old May 10th, 2000, 06:52 AM
djmouse djmouse is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 14 djmouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SR,

Thank you man! I'm already checking out those lessons on webmonkey. If you have some more of these links, please send me/e-mail them to me.

Thanx!

Dj Mouse

Reply With Quote
  #4  
Old May 10th, 2000, 11:41 AM
djmouse djmouse is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 14 djmouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SR,

I do have another question.
I looked at the code at Webmoney and now I'm trying to build my own validatechecker with the ereg() function. Here's what I'm trying to do:

I want the users to enter a valid "postcode".
A postcode contains exactly 4 leasing digits and 2 trailing letters, i.e.
1023DE or 1023 DE are valid postcodes
,but
12345 SED is not valid even as HDSK 12 is not valid.

I tried the following code, but it won't work.

function ValidPostcode($formname) {

if (!ereg("^[0-9]{4,4}[ t]{0,9}[[:alpha:]]{2,2}$",$formname) {
echo "No valid postcode!";
return false;
} else {
return true;
}

}

Do you have any suggestions?

Thanx,
Dj Mouse

Reply With Quote
  #5  
Old May 11th, 2000, 07:17 AM
falcon falcon is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 1999
Location: UK
Posts: 50 falcon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 33 sec
Reputation Power: 14
Hi,

Can I make a suggestion. Everything that you have requested in your original message can be done in JavaScript. Save yourself a lot of hassle by doing it client side.

Falcon

Reply With Quote
  #6  
Old May 11th, 2000, 07:40 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Javascript has its plus sides but not for form field validation. I apologize if this offends someone. Using javascript to validate form fields is a newbie approach and a bad idea as a web developer.

Reply With Quote
  #7  
Old May 11th, 2000, 08:39 AM
scollo scollo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 1999
Posts: 114 scollo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 44 sec
Reputation Power: 15
More specifically, client-side data validation is very insecure, since it is very simple for BAD PEOPLE to by-pass your validation just by turning off JavaScript. Then they can enter values into your form that can trick your server side code and/or database software into doing whatever evil things they want.

Always do your data validation server-side.

Now, back to the question at hand:

djmouse, is that a space that's allowed between the digits and the letters, or is it any whitespace character (tab, space, etc.)?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Validating forms - examples?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap