i m having problem in redirecting im making content management system
i get a values from posted form and then insert as an new row value is inserted correctly but i want to redirect it back to my content.php i use header("Location: content.php");
it gives me this error when i fill form and hit submit button it add new subject but it doesnt redirect me to my content.php and gives this error is "Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\widget_corp\includes\connection.php:1) in C:\xampp\htdocs\widget_corp\create_subject.php on line 14"
and my code for create_subject.php is is
<?php
$menu_name= $POST['menu_name'];
$position = $POST['position'];
$visible = $_POST['visible'];
$query = "INSERT INTO subjects (
menu_name, position, visible)
Values ( '{$menu_name}',{$position},{$visible})";
if(mysql_query($query,$connection)){
header("Location: content.php");
exit;
}else {
echo "<p> Subject creation is failed .</p>";
echo "<p>".mysql_error()."</p>";
}
and connection.php is
<?php
$connection = mysql_connect("localhost","root","");
if (!$connection){
die ("Database connection failed".mysql_error());
}
$db_select= mysql_select_db("widget_corp",$connection);
if (!$db_select){
die ("Database selection failed".mysql_error());
}
?>
please help me