Hi friends, I'm developing a web site using php/mysql (www.lankacarsale.com) and I want to validate all user inputs from client side using javascripts without using server side validation. And want to print a message in html format if user has disabled javascript in the browser. I jst want to knw what kinda function available in PHP to check javascript status in client browser or do you have any idea except server side validation same time give your ideas to improve the value of my site (if you have time )
Generate the form with javascript, so if the user doesn't have JavaScript enabled, he will not see the form. I don't like this solution, and I don't like client side verification (only) too, my advice is that you do both client and server side verification with an html form...
use html (not xhtml) tag, inside the headers. <noscript>there is message if browser don't support js</noscript> or you can try to search in $_SERVER array, or get_browser() function.
There's n way to find that out with PHP alone. Not with $_SERVER or get_browser() either. However, depending on what you want to do with the user submitted data, it can be very insecure not validating it. And you really can't rely on Javascript for such things.
There's really no way to check if a user has javascript turned on or off when they visit your site. You could put a bug in the noscript tags that will flip a switch in a database but it wont happen until they visit the site. I think your idea to validate user input using only javascript is terrible and very insecure. Never trust user input period! I can get around javascript validation very easy using Firebug for Firefox. Always validate the data server side and use javascript to help "guide" the user as to how you want the data input.