php - How to get ob_start() working correctly -
im getting error states:
warning: cannot modify header information - headers sent (output started @ /home/content/21/10941021/html/index.php:4) in /home/content/21/10941021/html/register.php on line 66
im thinking need put ob_start() buffering working correctly can't down. codes problems include:
<div class="lower-body"> <div class="left-lower">create account</div> <div id="account-first"> <?php ob_start(); if (isset($_get['success']) && empty($_get['success'])){ echo 'you\'ve been registered successfully!'; echo 'please check email , activate account!'; }else { if(empty($_post) === false && empty($errors) === true){ $register_data = array( 'firstname' => $_post['firstname'], 'lastname' => $_post['lastname'], 'username' => $_post['username'], 'password' => $_post['password'], 'email' => $_post['email'], 'zipcode' => $_post['zipcode'] ); register_user($register_data); header('location: register.php?sucess'); exit(); } else if(empty($errors) === false){ echo output_errors($errors); } } ob_end_flush();?>
and line 4 this:
<?php ob_start(); include 'includes/overall/head.php'; ?>
any ideas? lot!
header('location: register.php?sucess');
should before output echo
edit 1: use ob_start();
@ start of php code , ob_end_flush();
@ end, should solve problem.
edit 2: use this
<?php ob_start(); ?> <div class="lower-body"> <div class="left-lower">create account</div> <div id="account-first"> <?php ... ... ob_end_flush(); ?>
Comments
Post a Comment