Reply to Re: header("test"); does not display

Your name:

Reply:


Posted by Treefrog on 03/23/06 21:26

universalbitmapper wrote:
> OK I see it's looking more complicated than it really is.
> I just typed a 100 lines script from a manual: PHP MySQL Apache Web
> Development.
> Now, near the end there are these two lines:
>
> $url = "location: showimage.php?id=" . $lastpicid;
> header( $url );
>


Header() MUST be called before any output. have a single space before
the opening <? tag will break it. This is because the headers have to
be sent before the "meat" of the page. If there's a space, PHP thinks
you've done with the headers and want to start printing out a web page.
Check for spaces, html, anything before your first <? (or <?php) tag.

Also, I just can't resist correcting you for this, but your variable
name is wrong. $url isn't a url, you've included "Location:" in it. I
hate to be picky, but it will help to be strict when you start writing
BIG programs... Oh, casing your vars properly will help to, it's
subject to preference but I like camel case (each new "word" starts
with a capital). Erm, private cars also start with lower case, and
public with upper.

Try something like

$url = 'showimage.php?id'.$lastPicId;
header("Location: ".$url);


Good luck and enjoy yourself.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация