If you want an instant notification before the form is submitted from the client, then you need javascript.
If you want the form validated (which it should be anyway, never rely on javascript validation) after the submit button has been pressed and the data sent to the server, then you use PHP.