Jump to content

PHP Header Error:


timothyltaylor

Recommended Posts

I realize this is very common, especially when starting and stopping a session(). I'm not using those commands here, and still have a problem with the error:

"Warning: Cannot modify header information - headers already sent by (output started at /xxxxxx/xxxxxxx/xxxxxxxxxx-www/xxxxxxx/process.php:83) in /xxxxxxx/xxxxxxx/xxxxxxxxx-www/xxxxxxx/process.php on line 123"

Here's my code:
[code] $send = mail("[email protected]", "EPSA CAP2 Evaluation Results from $name", $body, "Content-type: text/html");
$send2 = mail('$email', "Your EPSA CAP2 Evaluation Results:", $body, "Content-type: text/html");
if($send)
header ("Location: xxxxxxxxx.com=1");
else
print "We encountered an error sending your mail, please notify [email protected]";
?>[/code]

Can someone give any suggestions?

Thank you!
    Lee T.
Link to comment
https://forums.phpfreaks.com/topic/30264-php-header-error/
Share on other sites

Thanks. That's a big help. Do I need to add an:
[code]ob_start();[/code] at the end?

Also,

1) How do I hide the url (with the user's password and username) in a php script?

ALSO

2) How do I carry user's (form) input records to another page, without grabbing them from the database?
      BECAUSE
            a) if I grabbed them from the database, I'd have to use the session_start () and session_stop () and I'd rather not

Thanks!
    Lee T.
     
Link to comment
https://forums.phpfreaks.com/topic/30264-php-header-error/#findComment-139359
Share on other sites

What if different users/different computers are accesing the form at the same time? Will each user's information be kept and displayed on a "results.php" page where the records are to be displayed in?

For instance
I want 1 user to store his name in the database. He fills it out, and then I grab that specific name to display it onto another page in a certificate. If I try and use the superglobal, $_Post, will it be able to grab his specific name - EVEN when other user's are accessing the same form from different computers? Or will the "saved" records get mixed up between users?

thanks for helping,
      Lee
Link to comment
https://forums.phpfreaks.com/topic/30264-php-header-error/#findComment-139368
Share on other sites

Good call.
So, say that I'm receiving the user's name through form input. The field input on the form is named "name".

I define it as : $name=$_POST['name']; in my "process.php file"

I can then go to a separate file named "results.php" and use: $name=$_POST['name'];

Then I can use the following code to display/use that same input value?:
[code]
...echo "      <p align=\"center\">This certificate is presented to</p>\n";
echo "      <p align=\"center\">$name</p>\n";  ...[/code]
Link to comment
https://forums.phpfreaks.com/topic/30264-php-header-error/#findComment-139478
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.