Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,865,148 members, 6,875,051 topics. Date: Sunday, 22 May 2022 at 12:35 PM

Php Header() Function Error - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Php Header() Function Error (2833 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)

(1) (Reply) (Go Down)

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"wink;
exit;
}

?>
Re: Php Header() Function Error by smartsoft(m): 1:34pm On Jul 15, 2006
Onydic you missed the quote "." ("location: prevpage.php"wink;
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, cheesy

(1) (Reply)

How To Get Mtn Double Data, Get 2gb For #500 / Nigeria First Free And Open Source Education Software / Please Help A Brother Tech Skill To Acquire In 2019!!! Tired Of 9-6 Jobs

(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 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 30
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.