pcw Posted March 16, 2009 Share Posted March 16, 2009 Hi, I keep getting the following error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/moveitho/public_html/sitebuilder/templates/common/header.php:46) in /home/moveitho/public_html/sitebuilder/data/library/form_validation.php on line 5 This is the code for form_validation.php <?php function form_validation() { session_start(); if(isset($_POST['submit'])) { $veritxt = $_POST['veritxt']; $username = $_POST['username']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $email = $_POST['email']; $firstname = $_POST['firstname']; $surname = $_POST['surname']; $street = $_POST['street']; $city = $_POST['city']; $county = $_POST['county']; $postcode = $_POST['postcode']; $country = $_POST['country']; $telephone = $_POST['telephone']; $mobile = $_POST['mobile']; $gender = $_POST['gender']; if ($_POST['veritxt'] != $_SESSION['veritxt'] OR $_SESSION['veritxt']=='') { print "Image verification unsuccessful."; } elseif ($username == '') { print "Please enter a username"; } elseif ($password1 == '') { print "Please enter your password"; } elseif ($password1 != $password2) { print "The passwords you supplied do not match"; } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { print "Please enter a valid email address"; } elseif ($firstname == '') { print "Please enter your first name"; } elseif ($surname == '') { print "Please enter your last name"; } elseif ($street == '') { print "Please enter your street address"; } elseif ($city == '') { print "Please enter your town/city"; } elseif ($county == '') { print "Please enter your county"; } elseif ($postcode == '') { print "Please enter your last name"; } elseif ($country == '') { print "Please enter your country"; } elseif ($surname == '') { print "Please enter your last name"; } elseif ($telephone == '') { print "Please enter your telephone number"; } elseif ($mobile == '') { print "Please enter your mobile number"; } elseif ($gender == '') { print "Please enter your gender"; } else { pin(); email_reg(); add_user(); } } }; ?> and this is the code for header.php <?php function pageheader() { print ' <html> <head> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 24px; } .style2 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; } .style3 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } { .style4 {color: #FFFFFF} .style6 {color: #FFFFFF; font-weight: bold; } .style7 {color: #FFFFCC} } a:link { color: #FFFF99; } --> </style> </head> <body bgcolor="#14285f"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="02021e"> <td height="58" nowrap="nowrap" colspan="3" id="logo" valign="bottom"><div align="center" class="style1">SiteBuilder Version 2.0 </div></td> </tr> <tr bgcolor="02021E"> <td height="57" nowrap="nowrap" colspan="3" id="tagline" valign="top"><div align="center" class="style2">Build your own membership site </div></td> </tr> </table> <br>'; }; ?> I cant figure out why I keep getting this error. How do I fix this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/149695-solved-session_start-header-error/ Share on other sites More sharing options...
Maq Posted March 16, 2009 Share Posted March 16, 2009 Put session_start() at the top of your page. If it doesn't validate you can always set a flag. Quote Link to comment https://forums.phpfreaks.com/topic/149695-solved-session_start-header-error/#findComment-786065 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.