Stats: 3,189,775 members, 7,938,347 topics. Date: Monday, 02 September 2024 at 11:51 PM |
Nairaland Forum / Science/Technology / Programming / Php Header() Function Error (2973 Views)
Function Points (FP) Vs Lines Of Code (LOC) / Programming Challenge - Navigate Using Same Cache Header / Without Using Pow Function In C (2) (3) (4)
Php Header() Function Error by onydchic(f): 12:27pm On Jul 14, 2006 |
Hey i need help with this, anyone good with php should let me know: I'm trying to use the header() function to pull a certain variable from the previous page to use in the next one. here's the code if (!$_GET[topic_id] ){ header(location: prevpage.php); exit; } instead i'm gettin 'cannot modify headers, header already sent' error. i've used it b4, so i'm stomped. any ideas? |
Re: Php Header() Function Error by skima(m): 11:12am On Jul 15, 2006 |
1. Make sure there is no space at the top of the page 2. make sure u have not outputed any data before using the function <?php if (!$_GET['topic_id'] ){ header("location: prevpage.php" ![]() exit; } ?> |
Re: Php Header() Function Error by smartsoft(m): 1:34pm On Jul 15, 2006 |
Onydic you missed the quote "." ("location: prevpage.php" ![]() |
Re: Php Header() Function Error by onydchic(f): 4:30pm On Jul 15, 2006 |
well, i used the quotes in the original. and the thing is, when i put it at the top of the page, it justs loads the previous page back! i'm stomped cos, i've used it before, and it worked. |
Re: Php Header() Function Error by Zahymaka(m): 9:10pm On Jul 15, 2006 |
Can you post your code let's have a look at it? If you've already echoed any content at the top of your file, then you can't use the header() function except you're using output buffering [let's not talk about that]. If you have outputted any content, before calling header(), you'll receive a warning. All header() calls are to be made before outputting any content, which is why I'm asking to see your code. Perhaps I could help you rewrite it. |
Re: Php Header() Function Error by Seun(m): 2:25pm On Jul 16, 2006 |
onydchic, they are right. It's one of the first problems people encounter when learning PHP. You cannot use the Header() Function after sending any output. There must be no space before your <?php segment and no echo statement before the Header() statement. Make sure you check all include()ed php files too. |
Re: Php Header() Function Error by onydchic(f): 10:20am On Jul 18, 2006 |
well, thanks all! i've solved the problem! turns out i forgot to generate the link from the previous page using the 'topic.id' variable! |
Re: Php Header() Function Error by smartsoft(m): 1:56pm On Jul 20, 2006 |
Anytime baby, more o r o r o 2 ur elbow, ![]() |
(1) (Reply)
Who Built Theses Apps. Wificall App, Oride App, And Kobo360 App / Cherrypy, Flask And Other Python Micros..... / Any Others Sharing Sites Like 4shared
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15 |