/    Sign up×
Community /Pin to ProfileBookmark

How do you redirect to a new page in PHP?

location (“page.php”); # doesn’t work

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@jpmoriartyFeb 26.2003 — the code is:

[code=php]
header("location:page.php");
[/code]


and since it's a header it's got to be sent before anything else is sent to the browser.

You may want to join us at the [URL=http://www.phpbuilder.com/board]php builder community forums[/URL] and check out [URL=http://www.php.net]the manual[/URL] .
Copy linkTweet thisAlerts:
@Zach_ElfersauthorFeb 26.2003 — Thanks.
Copy linkTweet thisAlerts:
@Rick_BullFeb 27.2003 — By the way you're supposed to specify a full URI (i.e. with the protocol and domain like "http://www.someserver.com/page.php"). I think it's part of the HTTP specification and is in the PHP manual.
×

Success!

Help @Zach_Elfers spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...