azeem123456 Posted February 20, 2010 Share Posted February 20, 2010 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 when i use header("Location: content.php"); it gives me this error when i fill form and hit submit 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 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>"; } plz plz help me out Link to comment https://forums.phpfreaks.com/topic/192688-help-urgent/ Share on other sites More sharing options...
trq Posted February 20, 2010 Share Posted February 20, 2010 If you had posted in the correct place you may have noticed this sticky. Link to comment https://forums.phpfreaks.com/topic/192688-help-urgent/#findComment-1015082 Share on other sites More sharing options...
jorley Posted February 20, 2010 Share Posted February 20, 2010 Not sure if this will work, but usually if any html is called before the redirect it won't work. Do these two things.. First, make sure there is no space after the closing ?> tag, that includes lines.. Second, try putting ob_start(); at the beginning of the page. So it looks like this. <?php ob_start(); code here ?> Link to comment https://forums.phpfreaks.com/topic/192688-help-urgent/#findComment-1015097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.