Hi!
i m getting following error on header. can any one help me.
Cannot modify header information - headers already sent by (output started at index.php:9) in index.php on line 19.
plz help me out. i need to work on project.
Getting Header Error Help!
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
use the following code in various places in your files and you will be able to narrow down the problem
hope that helps
Code: Select all
if (headers_sent())
{
print "headers were already sent above";
}
else
{
print "headers havent been sent yet, the problem is below";Hi Buddies thanx for help . Here's my code which is getting header error!.
<?php
$_REQUEST['username'];
$_REQUEST['password'];
session_start();
if (! isset($_SESSION['password'])) {
session_register("username");
session_register("password");
$_SESSION['password']=$_REQUEST['password'];
}
$passwd=$_SESSION['password'];
$pas='abc';
if(!session_is_registered('password'))
{echo "not registered";}
else
{ echo "session registerd";}
if($pas==$_REQUEST['password']){
$valid_user = 1;
}
else {
$valid_user = 0;
}
if ($valid_user==1)
{
echo "Suces";
// echo "$passwd";
header("Location: index.php");
}
else
{
session_unset();
session_destroy();
echo "Not a Valid User";
}
?>
And I have also tried using headers_sent() function that really narrowed down my problem. But couldnt solve it. thats pretty close to that. i just want to redirect User from current page to the Index Page.
<?php
$_REQUEST['username'];
$_REQUEST['password'];
session_start();
if (! isset($_SESSION['password'])) {
session_register("username");
session_register("password");
$_SESSION['password']=$_REQUEST['password'];
}
$passwd=$_SESSION['password'];
$pas='abc';
if(!session_is_registered('password'))
{echo "not registered";}
else
{ echo "session registerd";}
if($pas==$_REQUEST['password']){
$valid_user = 1;
}
else {
$valid_user = 0;
}
if ($valid_user==1)
{
echo "Suces";
// echo "$passwd";
header("Location: index.php");
}
else
{
session_unset();
session_destroy();
echo "Not a Valid User";
}
?>
And I have also tried using headers_sent() function that really narrowed down my problem. But couldnt solve it. thats pretty close to that. i just want to redirect User from current page to the Index Page.
thanx ! Markl999.
You made a valid point. There is really no point sending user info if they're to redirect. we can show them message at redirected page.that worked..Thanx alot...
Now Mark Would You Plz tell me how to use templates in php ? plz tell me the most easiest way to use them and from where i can download their libraries or classes.
and wot variables are needed to set in 4.3.4 version of PHP. i installed it on my windows xp machine with IIS through PHP Installer.
All i want is to create such a project which should run on every version of PHP irrespective of Server version of PHP.
Thanx in Advance..
You made a valid point. There is really no point sending user info if they're to redirect. we can show them message at redirected page.that worked..Thanx alot...
Now Mark Would You Plz tell me how to use templates in php ? plz tell me the most easiest way to use them and from where i can download their libraries or classes.
and wot variables are needed to set in 4.3.4 version of PHP. i installed it on my windows xp machine with IIS through PHP Installer.
All i want is to create such a project which should run on every version of PHP irrespective of Server version of PHP.
Thanx in Advance..
The search feature on this board is quite powerful. Type in "template engines" and you'll get plenty of topics discussing your questionfadi wrote:Now Mark Would You Plz tell me how to use templates in php ? plz tell me the most easiest way to use them and from where i can download their libraries or classes.
Reg. your second question: have a look at the tutorial section of this board.
Before you do that, please read the General Posting Guidelines, especially point 1 (click on the first link in my sig).