I searched on the various solutions with respect to my question about redirecting to a different webpage - both on this site and google.com, but I can figure out why i keep getting the error in my specific scenario -
the error being: : "Warning: Cannot modify header information - headers already sent by (output started at test_ecis_lib_pdo.php:3) in login_submit3.php on line 10".
The code of login_submit3.php:
<?php
//! include config file; includes session_start() and ecp php library
include 'config.php';
if(DBLoginSubmitA($mysql_hostname, $mysql_username, $mysql_password,$mysql_dbname))
{
//redirect to webpage depending on SESSION paramter ['customertype'
switch($_SESSION['customertype'])
{
case 'member':
header("location:members3.php",true,'301');
die();
break;
case 'admincrm':
header("location:admincrm3.php");
die();
break;
default:
break;
}
};
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPRO Login</title>
</head>
<body>
</body>
</html>
The code of config.php:
/*** begin our session ***/
session_start();
//! include lib after session_start()
include 'test_ecis_lib_pdo.php';
/*** mysql hostname ***/
$mysql_hostname = 'localhost';
/*** mysql username ***/
$mysql_username = 'root';
/*** mysql password ***/
$mysql_password = 'xxxx';
/*** database name ***/
$mysql_dbname = 'xxx';
?>
The code of test_ecis_lib_pdo.php (a library with functions - and where the error refers to) starts with:
<?php
//GLOBAL VARIABLES
$error = "no error";
$timezone = date_default_timezone_set("Europe/Amsterdam");
$CUSTOMER_TYPE=array(
"interested"=>"1",
"member"=>"2",
"chair"=>"3",
"admincrm"=>"4",
"adminfinance"=>"4",
"adminenergymanagement"=>"5"
);
I checked that the test_ecis_lib_pdo.php file does not send send any tags or echo text before calling header() but i still get the error - where do i go wrong??? Please your help.