Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with "header already sent" error. Not wh


johnnyosc

Recommended Posts

Hello Guys,

 

I been trying to fix this error with the header already sent in my PHPDev that I recently installed on my computer. It works on my host server but on my computer it doesnt and i get this error:

 

Warning: Cannot add header information - headers already sent by (output started at c:phpdevwwwdemocatalogincludeslanguagesenglishcreate_account_process.php:50) in c:phpdevwwwdemocatalogincludesfunctionsgeneral.php on line 32

 

I read the faq

 

(http://www.oscommerce.com/community/faq,1-7/q,17)

 

about the headers being a white space and all but i cant seem to find it in my files above that notes it.

 

heres mycode from create account process from the files error notice from above:

 

<?php

 

/*

 

$Id: create_account_process.php,v 1.12 2002/07/07 05:15:54 project3000 Exp $

 

 

 

The Exchange Project - Community Made Shopping!

 

http://www.theexchangeproject.org

 

 

 

Copyright © 2000,2001 The Exchange Project

 

 

 

Released under the GNU General Public License

 

*/

 

 

 

define('NAVBAR_TITLE_1', 'Create an Account');

 

define('NAVBAR_TITLE_2', 'Process');

 

define('HEADING_TITLE', 'account information');

 

 

 

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_NAME);

 

define('EMAIL_GREET_MR', 'Dear Mr. ' . stripslashes($HTTP_POST_VARS['lastname']) . ',' . "nn");

 

define('EMAIL_GREET_MS', 'Dear Ms. ' . stripslashes($HTTP_POST_VARS['lastname']) . ',' . "nn");

 

define('EMAIL_GREET_NONE', 'Dear ' . stripslashes($HTTP_POST_VARS['firstname']) . ',' . "nn");

 

define('EMAIL_WELCOME', 'We welcome you to <b>' . STORE_NAME . '</b>.' . "nn");

 

define('EMAIL_TEXT', 'You can now take part in the <b>various services</b> we have to offer you. Some of these services include:' . "nn" . '<li><b>Permanent Cart</b> - Any products added to your online cart remain there until you remove them, or check them out.' . "n" . '<li><b>Address Book</b> - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves.' . "n" . '<li><b>Order History</b> - View your history of purchases that you have made with us.' . "n" . '<li><b>Products Reviews</b> - Share your opinions on products with our other customers.' . "nn");

 

define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "nn");

 

define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "n");

 

?>

 

 

and here's the second file from functionsgeneral.php...its a long file so i pnly cut and paste the first 32 line that was notice in the error.

 

<?php

/*

$Id: general.php,v 1.196 2002/11/14 19:30:34 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

////

// Return a product's image

// TABLES: products

function tep_get_my_products_image($product_id) {

$product_normal_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'");

$product_normal = tep_db_fetch_array($product_normal_query);

return $product_normal['products_image'];

}

 

////

// Stop from parsing any further PHP code

function tep_exit() {

tep_session_close();

exit();

}

 

////

// Redirect to another page or site

function tep_redirect($url) {

header('Location: ' . $url);

tep_exit();

}

 

Any ideas how to correct this problem would be great and a big help to this confusion?????

 

Regards.

johnnyosc

Link to comment
Share on other sites

I found when I get that error if you go to the end where you see this ?> Put your cursor at the tip of the > and hit delete, that should solve your problem. (it eliminates the white space)

Link to comment
Share on other sites

Try this:

 

your code as posted:

define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "n"); 



?>

get rid of the extra line and make sure there's no space before or after the closing ?>

define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "n");

?>

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

another thing you can try is if you use bbedit or some other 'programmers' editor, see if there is a show invisibles command that will show line breaks, spaces, etc. as some ascii code - this can save you a lot of time hunting

 

finding the one white space can drive you crazy - its like finding a white mouse in a blizzard.....

Link to comment
Share on other sites

Thanks so much guys for the quick multiple replies!!

It resulted in me solving the problem.

 

Here was the solution:

 

define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "n");?>

 

old code was:

 

define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send a email to ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "n");

 

?>

Link to comment
Share on other sites

That's really weird because whitespace within <? ?> doesn't get sent to the browser, and is therefore not outputted

I think there was actually a space AFTER his closing ?> before the change - just wasn't recognized

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

I found when I get that error if you go to the end where you see this ?> Put your cursor at the tip of the > and hit delete, that should solve your problem. (it eliminates the white space)

 

Yes, when you get the "headers already sent" error it always resolves by eliminating the trailing spaces at the end of the code, sometimes in your editor it will appear there are no trailing spaces but once you put your cursor down there and start hitting delete you'll be surprised to see how many there actually are.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...