Jump to content

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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.