vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Headers already sent... (https://vborg.vbsupport.ru/showthread.php?t=41905)

mr e 08-04-2002 07:51 PM

Headers already sent...
 
Ok this is what I get...
Code:

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/wcgalaxy.com/httpdocs/index.php:26) in /usr/local/psa/home/vhosts/wcgalaxy.com/httpdocs/shoutbox.php on line 31
Here is line 26 of index.php
PHP Code:

<? include ("header.php") ?>

and here is line 31 of shoutbox.php
PHP Code:

header ("Location: [url]http://www.wcgalaxy.com/[/url]"); 

I can't for the life of me, figure out how to get it to not give me this error when you hit submit on the shoutbox, when you hit submit, it basically writes to a text file and then tries to refresh the page to display your shout, but when it refreshes I get this error.

Xenon 08-04-2002 08:19 PM

be sure you don't have any output before the header() function in your shoutbox.php

mr e 08-04-2002 08:45 PM

what i have is
PHP Code:

if (this) {
   print 
"something"
} else {
variable declaration and such
header
() 

would the print have anything to do with it?

Xenon 08-04-2002 08:48 PM

yes that's it...

you cannot use header after you have used print or echo or something like that

mr e 08-04-2002 08:58 PM

ok i switched it around to do
PHP Code:

if (this) {
   
variable declaration and such
   header
()
} else {
   print 
"something"


but it's still giving me the same error

Xenon 08-04-2002 09:05 PM

be sure there are no other output functions before the header:

remeber a empty line after the last ?> in header.php or a empty line before the first <? are also outputs

mr e 08-04-2002 09:11 PM

well header.php is all HTML, and it looks like it's not even running the header() command so is there any other way to redirect you to a page after you hit Submit? I have...
PHP Code:

if ($submit) {
  
variables and stuff
  header
()
} else {
HTML form


and i want to redirect the user after he/she hits submit

Xenon 08-04-2002 09:16 PM

you could code a redirect with javascript (look at how vb makes that)

don't ask me how to code javascript, i don't know javascript ;)

mr e 08-04-2002 09:23 PM

wow, i just figured that out then read your post, for javascript you do...
Code:

<script language="javascript">
    window.location.href=("<?php echo $url; ?>");
</script>

thanks for the help though :D


All times are GMT. The time now is 08:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00991 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete