I want a milion euro's!? can you give it to me? LOL Please describe what you have done with examples to your works and what didn't work so we can help you figure out where you need help, i'm not going to put alot of time in just requesting a piece of scriping. So please show some code and things you triend and or have done!
PHP runs on the server and creates the HTML, CSS and Javascript. It then sends this to the browser, where the Javascript runs. PHP isn't in the browser, so Javascript has nothing to do with PHP. As Eric said - what are you trying to accomplish? In English, not in programming terms. (To validate a textbox in Javascript, you just write Javascript to make sure that what's in the textbox is what you want - all digits, no digits, 2 or more words, a sane-looking email address, etc.)
Nothing at all to do with AJAX, although AJAX uses the same principles. Verifying user input is a two-step process. You validate what you can in Javascript, so you don't waste bandwidth sending obviously useless data to the server. Then you verify all input in PHP once it gets there. (For instance, you can't use Javascript to verify whether the email address the user gives you is a real email address, no matter how well it conforms to the standard, but you can verify that it contains '@' twice, which makes it invalid.) As far as 'redirecting' the PHP script (in the OP), that sounds as if it's dependent on the data, so PHP can determine that all by itself.
Use JQUERY, you can string a valid email address using REGEX by calling "var email = new regex(/sample/i,string);"
Try using a javascript validation script so they must complete the form, after they do its sent to browser on submit and IF the variables have been completed it will redirect. The PHP code goes at the top and doesn't activate until the last variable in your form is present if($_POST['last_variable']) Then it runs the code block..and redirects. rather standard and basic.
right, its resent and browser/page is reloaded and activates the code and redirect upon next page reload. Which is standard in most forms that submit to self /page.
This is a VERY important point that many novice developers fail to implement. Javascript client-side validation is NOT enough. Javascript can be disabled, it can be edited, it can be bypassed. When the accuracy and integrity of your data must be correct, you must always rely on server-side validation, typically in conjunction with the initial JS validation.
It's best to have core validation server side, mainly if this refers to site security and functionality. Javascript validation is mainly cosmetical and for fine tuning forms. Can be used for common errors so user's don't have to wait for page to submit and don't load your server with many useless requests.