I know that php can validate data input before querying to the database

but which is more preferable by the developer or user experience?

validation thru php? or validation thru javascript?

whats your insight about this?

thank you!

i guess the question is not whether to validate through php (server side) or through javascript(client side).. i think it is more of a question of validating the form before sending to the server or sending the form to be validated at the server..

i guess one of the reason's why a lot of effort has been placed into ajax is because it is, IMHO, better to validate while still at the form prior to sending the data.

Users want nice looking websites and javascript validation does perform some nice visual tricks, however...

webmasters want security because ANY data coming from a users browser via a URL GET or POST even cookie information is suspect and needs to be checked server side before the other script functions get to use it.

To keep both happy then both systems should be used.

what ^he^ said

validation solely at the client is useless, information can be spoofed too easily
validation solely at the server is useless, too many reloads for incomplete forms, large amounts of data transfer for no real purpose
combination of clientside, so the form is completely filled, the data is appropriateley formed;, then at the server to validate the data and complete the submission

very well said! thanks for all your help mates! thanks a lot!