Bluehost.com Web Hosting $6.95

[PHP or maybe JavaScript or CSS] protecting my PHP from bad input

This is a discussion on [PHP or maybe JavaScript or CSS] protecting my PHP from bad input within the PHP General forums, part of the PHP Programming Forums category; #The problem: This is about protecting my PHP from bad input (e.g.: letters instead of numbers). ## Is there a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-19-2003
Miroslav I.
 
Posts: n/a
Default [PHP or maybe JavaScript or CSS] protecting my PHP from bad input


#The problem:
This is about protecting my PHP from bad input (e.g.: letters instead of
numbers).

##
Is there a way to prevent user from even inputting a letter in a text box?

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 11-19-2003
Eugene Lee
 
Posts: n/a
Default Re: [PHP] [PHP or maybe JavaScript or CSS] protecting my PHP from bad input

On Wed, Nov 19, 2003 at 08:18:32AM +0100, Miroslav I. wrote:
:
: #The problem:
: This is about protecting my PHP from bad input (e.g.: letters instead
: of numbers).

Good idea. You need to make sure user-inputted data is valid.

: ##
: Is there a way to prevent user from even inputting a letter in a text
: box?

There's two general ways to do data validation: client-side and
server-side. PHP is server-side. JavaScript is client-side.

With PHP, you allow the user to enter any data in the textbox, then code
in logic to check for illegal characters (e.g. no letters in a textbox
for one's phone number). Of course you must also code a nice response
to let the user know when the data is found to be illegal, repost the
form, etc.

With JavaScript, you can do data validation as they press the submit
button, or even disallow illegal characters as they type in a textbox.
The response is far more immediate and thus far more effective, IMHO.
Of course, if the user's web browser isn't running JavaScript, bad data
may still slip through. Then you must use PHP and do server-side data
validation.
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:45 AM.


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