![]() |
HTML FORMS and PHP
I have a webpage mypage.htm that has a form which has it's action as "mypage.htm" I.e. Reloads itself with some posted values
I have some embedded PHP which check the fields are valid (email address, not blank etc) and if they are not shows an error against the invalid entries An internal field "$allvalid" is 0 when all is ok and > 0 when errors are present I want to redirect "mypage.htm" to some other page I.e. "success.htm" if $valid=0, I've tried the "Header: Location ..." but this won't work because I am already outputting data to screen Any ideas? :confused: |
Re: HTML FORMS and PHP
Best way is to use Javascript afterward, but you can work around in PHP like this:
PHP Code:
|
Re: HTML FORMS and PHP
Quote:
You could rewrite mypage.htm as php, but I don't totally approve of mixing content and programmatical data in the same file. Easier to debug if you keep it separate. |
Re: HTML FORMS and PHP
Sorted it, just do all the error checking and redirection before starting any output! (doh!)
I am too old for this stuff |
Re: HTML FORMS and PHP
That's the key - remember that once you start printing to browser, you can't stop. Like Pringles.
OK, that's the Guinness talking... |
| All times are GMT. The time now is 12:35. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum