Correct,
Have the page POST to itself, validate the form input in PHP and while
still in PHP, redirect.
Otherwise, if you have errors, generate the applicable HTML.
Here's some pseudo code:
<?php
if (isset($_POST))
{
//check data
if (good) location('...');
else
echo "<FormWithErrorMessages>";
}
else
{
echo "<DefaultForm>";
}
- Ben
Konstantin Rozinov wrote:
You should place all of your PHP code that validates/redirects in the
beginning of the HTML/PHP file, BEFORE any HTML is spit out.
<?php
code to validate....
?>
<html>
<form>
...
</html>
On Thu, Jun 11, 2009 at 7:31 PM, tu...@netzero.net<tu...@netzero.net> wrote:
Hi everybody!
I need help in redirecting my link to a different page within my website. I
read the manuan on "Header" function and it stae:
Remember that header() must be called before any actual output is sent,
either by normal HTML tags, blank lines in a file, or from PHP. It is a very
common error to read code with include(), or require(), functions, or
another file access function, and have spaces or empty lines that are output
before header() is called. The same problem exists when using a single
PHP/HTML file.
<html>
<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: http://www.example.com/');
?>
If this statement is true, then how do you use header() function in any
script that does not contain any "normal HTML tags" since you typically have
to output something, whether before or after the call to the header()?
It seems to me that type of rule is basically narrows the scope of the
script to a very limited thing you can do, such as you can output the
registration form to browser to allow the users to fill out the form, which
is what I'm trying to.
To be specifically, when a page is open, I present (output) a registration
form to the users to register and when the user is finished with the form
and I validate it and redirect that information to a different page sending
those information along. That's all I'm trying to do--redirect from one page
to the next without the end-user ever have to click on the link.
Thanks in advance!
Paul
____________________________________________________________
Click here to find the right stock, bonds, and mutual funds.
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org/show_participation.php
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org/show_participation.php