[nycphp-talk] Header() Redirect!!
Konstantin Rozinov
krozinov at gmail.com
Thu Jun 11 19:56:45 EDT 2009
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, tuon1 at netzero.net<tuon1 at 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
>
More information about the talk
mailing list