Jump to content

If statment to open diffrent page


tobywuk

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?
Link to comment
https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/
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
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]

Archived

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

×
×
  • Create New...

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.