Page 1 of 1

insert statements

Posted: Thu Apr 08, 2004 6:28 am
by nikko50
Hi there. I have an include statement that is conflicting with my program. In the statement below you can see if I comment out the include statement the IF statements work. If I place the include statement back into the program the IF statements don't calculate anything and the program continues. I need some help. Why is this happening???

if(!$getuserline[realname])
{
header("Location: login.php");
}
else
// {
// include ("navibar.inc.php");
//
// }

if($radiogo =="insert")
{
header("Location: shipsingle.php");

}
elseif($radiogo =="update")
{
header("Location: static.php");

}
elseif($radiogo =="viewall")
{
$query= "SELECT * FROM shiplist WHERE quantity > 0 AND store = '$store' ORDER BY date";
mysql_query($query) or print(mysql_error());
$getstorearray=mysql_fetch_array($query, MYSQL_ASSOC) or print(mysql_error());
echo $getstorearray;

}

Posted: Thu Apr 08, 2004 6:51 am
by Illusionist
what is this??

if(!$getuserline[realname])

Posted: Thu Apr 08, 2004 7:13 am
by nikko50
Hi there. That tests a session register.

Posted: Thu Apr 08, 2004 7:16 am
by markl999
Try putting exit; after all your headers', eg

header("Location: login.php");
exit;

Posted: Thu Apr 08, 2004 7:33 am
by nikko50
Hi there. Thanks for the response. I tried that but it does'nt work. The if statements are still skipped.
Sharon :(

Posted: Thu Apr 08, 2004 7:38 am
by markl999
Does navibar.inc.php output anything? If so then you won't be able to do any header("Location's after it as you can redirect using header after output has been sent.
Try putting error_reporting(E_ALL) at the very top of the script, it will throuw out alot of warning that you should fix, such as doing if(!$getuserline[realname]) .. it will warn you about an undefined constant as it expects you to use $getuserline['realname'] .. and it might also highlight where the problem is.

Posted: Thu Apr 08, 2004 7:46 am
by nikko50
Hi again. Thanks for the help!! navibar.inc.php outputs a navigation bar at the top of the page.

Posted: Thu Apr 08, 2004 7:51 am
by markl999
Then none of the header Locations following the include will work as you've sent output.