PHP Form Validation

Tips 2008. 1. 21. 16:52

HTML 태그 내의 FORM 태그는 사용자 입력을 받는 부분이다.

이 부분은 사용자의 잘못된 입력의 가능성을 내포하고 있기 때문에

반드시 유효성을 검사해야만 한다.

유효성 검사는 두 곳에서 가능하다.

첫 째는 클라이언트에서 할 수 있고, 둘 째는 서버에서 할 수 있다.

클라이언트 측에서 하면 서버의 부하를 줄일 수 있고,

서버 측에서 하면 보안을 강화할 수 있다.

서버 측에서 유효성 검사를 할 때에는 같은 페이지에서 할 것을 권장한다.

다음 글을 참고하기 바란다.



User input should be validated whenever possible. Client side validation is faster, and will reduce server load.

However, any site that gets enough traffic to worry about server resources, may also need to worry about site security. You should always use server side validation if the form accesses a database.

A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error.



Reference:
http://www.w3schools.com/php/php_forms.asp

Posted by 알 수 없는 사용자
,