u can use javascripts to check it. <script language="JavaScript" type="text/javascript"> function check( form ) { if (form.email.value == "") { alert( "Please enter your email address." ); form.email.focus(); return false ; } } </script> this scripts will work fine.
EDIT: A few seconds too late... Don't use JavaScript to validate the user input. It's not secure at all. if (trim($_POST['foo']) == '') { echo 'Please fill out all required fields.'; } PHP:
He mean by this , user can disable javascript ... The best would be to : - test user side then test server side
Yes, as additional check. But I often find it a waste of time when you have to code the PHP check anyway. In some cases it can be useful indeed, to prevent users fro having to use the back button, etc...