Home > Archive > PHP Language > May 2004 > page redirection
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| OneSolution 2004-05-18, 7:30 pm |
| Hi All,
I found out that I can use the header function to redirect a page. However,
it gives me an error like that:
Warning: Cannot add header information - headers already sent by (output
started at /xxx/xxx/html/xx.php:10) in /xxx/xxx/html/xx.php on line 11
Here's my code:
<?php
$name=$_POST["name"];
$email=$_POST["email"];
$phone=$_POST["phone"];
$xxxx=$_POST["xxxx"];
$currentUserId=$_POST["userid"];
if (($name != "") && ($email != "") && ($phone != "") && ($xxxx!= "")) {
echo "processed $userid";
Header("Location: http://localhost/xxxx/xxxx.asp?id=" . $currentUserId);
}
?>
What I want to do is migrate some data. So my source data is in an MS
access file, and I've found that I can't simply export the data. So I
created a form in ASP that will pull each row from the access db into a
form. The form will auto submit to a PHP. The php will take the submitted
info and save it to the mysql db. Then it will return the user to the
original ASP with the userid that was just processed. The ASP will update
the Access database to show that the row has been saved, and then load the
next row and continue the process.
In ASP, I could say
response.redirect(http://location.asp?userid=xxx)
When I try this in PHP, it complains with the above error message.
Can anyone help?
Thanks,
Z
| |
| Alvaro G Vicario 2004-05-19, 7:30 am |
| *** OneSolution wrote/escribió (Tue, 18 May 2004 22:07:25 GMT):
> echo "processed $userid";
> Header("Location: http://localhost/xxxx/xxxx.asp?id=" . $currentUserId);
You can't send HTTP headers (such as "Location") after the page content
itself. Headers come first, content comes afterwards. In this case, headers
are used to request the browser to perform a page redirect, so you don't
even need content: it won't be seen.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
| |
| OneSolution 2004-05-19, 12:30 pm |
| Thanks!
"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> wrote in
message news:4gpfsavfwgyp$.1snogd5qoyyb9$.dlg@40tude.net...
> *** OneSolution wrote/escribió (Tue, 18 May 2004 22:07:25 GMT):
$currentUserId);[color=darkred]
>
> You can't send HTTP headers (such as "Location") after the page content
> itself. Headers come first, content comes afterwards. In this case,
headers
> are used to request the browser to perform a page redirect, so you don't
> even need content: it won't be seen.
>
>
>
> --
> --
> -- Álvaro G. Vicario - Burgos, Spain
> --
|
|
|
|
|