Re: Poll of sorts: Javascript Form validation or PHP

From: Date: Fri, 05 Dec 2008 18:32:19 +0000
Subject: Re: Poll of sorts: Javascript Form validation or PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-284187@lists.php.net to get a copy of this message
On 5 Dec 2008, at 18:28, Terion Miller wrote:
I have a huge form to validate and wonder which is better javascript validation or php, the page is a php page, I actually put js validation on it but then it stopped working (stopped inserting into the db) not sure if that had anything to do with it.... What does everyone prefer?
Both. Always PHP, optionally with JS to cut down on pointless HTTP requests. Never ever trust anything coming from the client, even if you have JS checking it first. The client may not have JS support either due to the user turning it off or just because it doesn't. Your control over the data starts when your server-side script is executed, not before. -Stut -- http://stut.net/

« previous php.general (#284187) next »