Jump to content

Archived

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

tobywuk

If statment to open diffrent page

Recommended Posts

i have the code

[code]

if($_POST[password] == $correct)
{
http "blogentry.php";
} else {
echo "Password was incorect";
include("index.php");
}
?>
[/code]

im trying to make it so if the password is entered correctly the page blogentry.php will load. the only thing is i dont know how to do this. I know if i put echo"password is correct" this will display but i dont want just text to display i want the page to actualy load. I'v tried include"blogentry.php" but this just opens up that page within that webpage which i dont want

can anyone help?

Share this post


Link to post
Share on other sites
You want to use the [a href=\"http://www.php.net/header\" target=\"_blank\"]header[/a]() function here:
[code]<?php
if($_POST['password'] == $correct)
{
     header("location: blogentry.php");
     exit();
} else {
echo "Password was incorect";
include("index.php");
}
?>[/code]

Ken

Share this post


Link to post
Share on other sites
i put that in but now i get

Warning: Cannot modify header information - headers already sent by (output started at /home/tobywuk/public_html/nstorm/bloglogin.php:9) in /home/tobywuk/public_html/nstorm/bloglogin.php on line 21

line 21 is [code]header("location: blogentry.php");[/code]

Share this post


Link to post
Share on other sites
Read the [a href=\"http://www.phpfreaks.com/forums/index.php?s=&showtopic=37442&view=findpost&p=138336\" target=\"_blank\"]sticky note[/a] at the top of the forum.

Ken

Share this post


Link to post
Share on other sites
Dont forget to read the [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95562\" target=\"_blank\"]FAQ/Code Respority[/a] forum either.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.