Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

header() giving me error // " header already sent"

$
0
0

Hey guys,

 

I am currently trying to finalize my registration page, and i am have some issues with the header() function.

 

i know there are certain rules like no html can be above the header. and what not but i am fairly new to this and can figure out why i am outputting an error. 

 

my code is :

<?if (isset($_GET['success'])  &&  empty($_GET['success'])) {
echo '<h1> Thank you for your registration </h1>'; 


} else {
if (empty($_POST) === false && empty($errors) === true ) {




$register_data = array(
'email'   => $_POST['register_email'],
'username'  =>  $_POST['register_username'],
'password'  =>  $_POST['password'],
'gender'   =>  $_POST['gender'],
'month'  =>  $_POST['month'],
'date'  =>  $_POST['date'],
'year'       =>  $_POST['year'],
'country'   =>  $_POST['country'],


);


user_register($register_data);
header('Location: register.php?success');
exit();


} else if ( empty($errors) === false) {
echo '<div class="register_errors">';
echo '<span style="color:red"><h3>';


echo output_errors($errors);


echo '</h3></span>';
echo '</div>';


}
}


?>
 

 

All of the code works for me until i try to send send the message. 

 

The error i get is the following :

 

Warning: Cannot modify header information - headers already sent by (output started at /home/justin/public_html/include/header.php:31) in /home/justin/public_html/register.php on line 67

 

it directs me to my header.php file 

 

<!DOCTYPE html>
<div>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="#">
<meta name="keywords" content="#">
<meta name="description" content="#">
<meta name="robots" content="#">
<meta name="revisit-after" content="7 days">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/normalize.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jscript/sidebar.js"></script>
<script type="text/javascript" src="jscript/mootools.js"></script>

<body>

<div class="top">

Any suggestions ?

 

cant seem to figure this one out

 

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles