Re: redirecting in the middle of a code



Raistlin Majere wrote:
if ($email != VALID_email)
{
header("Location: create3.php?error=invalid_email");
} else if (!empty($db_email)) {
header("Location: create3.php?error=already_email");
} else {
if($password != VALID_PASSWORD)
{
header("Location: create3.php?error=invalid_password");
} else if (!empty($db_password)) {
header("Location: create3.php?error=already_password");
} else {
mysql_query('INSERT INTO `accounts` VALUES (``, $email,
$password)');
header("Location: index.php");
}
}
mysql_close();


Warning: Cannot modify header information - headers already sent by
(output started at C:\AppServ\www\opinionsofamateurs\accounts
\create2.php:12) in C:\AppServ\www\opinionsofamateurs\accounts
\create2.php on line 32


How to solve?

It is a 5 step process:

1) Go to groups.google.com
2) In the search box put Warning: Cannot modify header information
3) Click on the first article at the top of the page (it is an article in
this group)
4) Read
5) Think to yourself, why didn't I do that at the start.


.



Relevant Pages

  • Warning Message
    ... connecting to a secure web site. ... The user accesses a site over the web the ... "Warning. ... Cannot modify header information - header ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: [PHP] Problem with Redirect
    ... Warning: Cannot modify header information - headers already sent ... You could also consider not doing a redirect at all, ...
    (php.general)
  • Headers already sent problem online, but not offline
    ... script and run it, it says the headers have already been sent. ... the script, and the information about the file is read out from a database, ... Warning: Cannot modify header information - headers already sent by (output ...
    (comp.lang.php)
  • Re: Splitting uploads up/ concatenating them back together
    ... my downloader script looks like this: ... Warning: file_get_contentsexpects parameter 1 to be string, ... Warning: fclose: supplied argument is not a valid stream resource in ... Cannot modify header information - headers already sent by ...
    (comp.lang.php)
  • How to tell if Mime type matches contents
    ... that a link's content type matches it's contents. ... Warning: mysql_result: Unable to jump to row 0 on MySQL result index ... Warning: mysql_result: supplied argument is not a valid MySQL result ... Cannot modify header information - headers already sent by ...
    (comp.lang.php)