joined:Feb 22, 2009
Well, be that as it may, but consider this: To run java script, the users browser needs to be able to use JS, and as a lot of people now turn it off amid security fears (there has been a security exploit recently with a new worm that around) either that or they have the "prompt me before executing" option enabled.
A lot of these checks can quite easily be done with JS, but personally I prefer to use the php engine to handle all validation, it's not too difficult to check for submission's (from form or the command line, that's if someone wants to circumvent the form of course) whether the fields are correctly filled in, and there are some pretty nifty things you can do with regex that can sift through data sent to see if it matches the criteria that you want to stop from being submitted.
And above all, as it's server side there is no compatibility issue, this is only my opinion, the solution's posted will work, I just thought I would stand up for php!
Oh, just one point to make here too:-
if (($_POST['e_mail'] == "") || ($_POST['u_name'] == ""))
If you have condition one
and are checking against condition two
and you want to check either is evaluating to true, which in this case you are, to express this in a more readable manner, parenthesize the evaluating components so that it is easier to read, so that you are basically saying if( (this equals true) || (this equals true) ) then you can see much clearer what's going on. Also have a read of this
[php.net] to see the differences between || and or.