/    Sign up×
Community /Pin to ProfileBookmark

Header() Question

I have this contact form and I use the header function to process the new info.

Here is my error
Warning: Cannot modify header information – headers already sent by (output started at /home/showmes/public_html/header.php:4) in /home/showmes/public_html/contact.php on line 16

My question is could adding ,false fix that error?
<?PHP header(“Location: index.php”, false); ?>

[url]www.maddDidley.com[/url]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@emin3mOct 07.2005 — possibly you header.php is already outputting something on the browser

so contact cant use the header function

replace [CODE]<?PHP header("Location: index.php", false); ?>[/CODE]
with [CODE]<?php
echo "<script language='javascript'>
document.location='index.php';
</script>"
exit(); //exit is optional
?>[/CODE]


for more info check

http://www.webdeveloper.com/forum/showthread.php?t=81073

&

http://www.webdeveloper.com/forum/showthread.php?t=81178
Copy linkTweet thisAlerts:
@madddidleyauthorOct 07.2005 — I'm sorry I am using <?PHP header("Location: index.php"); ?>.

Do you think adding the ,false would help.

Here is a little snipet from php.net

The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type.

But thanks, I will try the javascript.
Copy linkTweet thisAlerts:
@NogDogOct 07.2005 — That error occurs if [i]anything[/i] on that page outputs even just one space or linefeed character to the browser before the header() function is called. This means your page needs to start out with the [b]<?php[/b] tag with no spaces or linefeeds before it, and then the header() call must come before you do any outputs via echo, print, etc.
Copy linkTweet thisAlerts:
@madddidleyauthorOct 11.2005 — Well, I never got that error with the header function on my local server for testing or any my other host. Just on this one for this client. I changed the header() to the javascript and that fixed my problems as far as that goes. But now I am using a cookie to make sure he's logged in and I get the same error.

<?PHP setcookie("cookieLogin",$id,0); ?>

Warning: Cannot modify header information - headers already sent by (output started at /home/showmes/public_html/admin/header.php:4) in /home/showmes/public_html/admin/index.php on line 51


I don't get this error either when I'm testing on my computer but I do on this server through www.mher.org. Do you think they could have something turned off or something like that?

Project:

www.ShowMeStreetCustoms.com



Ha ha ha.....I finally got it. Thanks anyway, but this may not be over.
Copy linkTweet thisAlerts:
@NogDogOct 11.2005 — Maybe try starting the script with an [url=http://www.php.net/ob_start]ob_start()[/url]?
×

Success!

Help @madddidley spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...