critical-state Posted August 7, 2008 Share Posted August 7, 2008 Hi, I am having issues with some code I have written. I have commented the problem section below. the warning message I am receiving is:Warning: Cannot modify header information - headers already sent by (output started at C:\www\Projects\test2.php:21) in C:\www\Projects\test2.php on line 33. Any ideas or a way round would be great! Andy <select name="day"> <?php error_reporting(E_ALL); $day=0; $year=0; $_POST['day']=0; $_POST['year']=0; for($day=01;$day<=31; $day++) { echo"<option value='".$day."'"; if($day==$_POST['day'])echo "selected"; echo ">" .$day. "</option>\n"; } ?> </select> <select name="year"> <?php for($year=date("Y");$year>=1900; $year--)//If I set the year to above 1922 I do not get the error message ??? { echo"<option value='".$year."'"; if($day==$_POST['year'])echo "selected"; echo ">" .$year. "</option>\n"; } ?> <input type="submit" value="go"> <?php $url= "http://localhost/projects/confirm_signup.php"; header ("location: $url"); exit(); ?> Link to comment https://forums.phpfreaks.com/topic/118593-solved-cannot-modify-header-information-error/ Share on other sites More sharing options...
JasonLewis Posted August 7, 2008 Share Posted August 7, 2008 Check out the stickied thread at the top of the PHP Help board. Link to comment https://forums.phpfreaks.com/topic/118593-solved-cannot-modify-header-information-error/#findComment-610551 Share on other sites More sharing options...
critical-state Posted August 7, 2008 Author Share Posted August 7, 2008 Cheers I have now sussed it. I should have used output buffering at the top of my page. thanks for the advice though! Link to comment https://forums.phpfreaks.com/topic/118593-solved-cannot-modify-header-information-error/#findComment-610561 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.