Hi, its me again!
I have faced this error trying to redirect from one page.
Here is the error:
Warning: Cannot modify header information - headers already sent by (output started at I:\xampplite\htdocs\site\insert.php:3) in I:\xampplite\htdocs\site\insert.php on line 28
Illegal action or other errors!
here is insert.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
//$_SESSION["name"] = "Test Admin";
$content = $_POST["content"];
//prepare data
//array should have description , heading , contents, creator
//$array_values function name insertdata
$values['description'] = $_POST["content"];
$values['heading'] = $_POST["heading"];
$values['contents'] = $_POST["contents"];
//this will include currently loggen in user
$values['creator'] = "Test Admin" ;//$_SESSION["name"];
//database call
require("/includes/inc.database.php");
$db = new Connectdb();
$conn = $db->connect();
$data = $db->retrievedata($conn, 'articles');
if ($db->insertdata($conn, $values)){
echo("Insert Succesful!");
header('Location:/site/view.php');
die("Illegal action or other errors!");
}
else{
echo("Failed to write an article");
header('Location:/site/editor.php');
die("Illegal action or other errors!");
}
?>
</body>
</html>