Hey i'm learning PHP with some tutorials from lynda.com. And in the tutorial we are making a CMS. I follow the steps as in the tutorial even got the file from lynda.com and its perfect the same but in the tutorial it works and when i do it the header location doesn't work help.
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); ?>
<?php
$menu_name = $_POST['menu_name'];
$position = $_POST['position'];
$visible = $_POST['visible'];
?>
<?php
$query = "INSERT INTO subjects (
menu_name, position, visible
) VALUES (
'{$menu_name}', {$position}, {$visible}
)";
$result = mysql_query($query, $connection);
if ($result) {
// Success!
header("location:content.php");
exit;
} else {
// Display error message.
echo "<p>Subject creation failed.</p>";
echo "<p>" . mysql_error() . "</p>";
}
?>
<?php mysql_close($connection); ?>
the error that i get is as followed
Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/Widgetcorp/create_subject.php:5) in /Applications/MAMP/htdocs/Widgetcorp/create_subject.php on line 19