[php] <?php require_once("includes/functions.php"); ?>
<?php require_once("includes/constance.php"); ?> <?php $menu_name = $_POST['menu_name']; $position = $_POST['position']; $visible = $_POST['visible']; try{ $conn = connection(HOST,DB_NAME,DB_USER,DB_PASSWORD); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(PDOException $e){ echo 'Error:'. $e->getMessage(); } if(!empty($menu_name) || !empty($position) || !empty($visible)){ $stmt = $conn->prepare("INSERT INTO subjects(menu_name,position,visible) VALUES(:menu_name,:position,:visible)"); $success = $stmt->execute(array( 'menu_name' => $menu_name, 'position' => $position, 'visible' => $visible )); } [/php] I like to redirect page after inserting value. If I use code like bellwo [php]if ($success) { header('Location:http://localhost/php/widget_corp/content.php'); } ?>[/php]It showing warning message like bellow.
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\php\widget_corp\create_subject.php:1) in C:\xampp\htdocs\php\widget_corp\create_subject.php on line 31
How can I fix this ?