salman233 Posted June 9, 2011 Share Posted June 9, 2011 help me out guys my code <?php include "conn.php"; if(isset($_POST['sumbit'])){ echo "hello"; } if($_GET['done']=='1'){ echo "<font color='green'>inserted</font>"; } else { echo mysql_error(); } ?> <form action="page.php" method="post"> <input type="text" name="myname" id="myname" maxlength="96"> <input type="submit" name="submit" value="submit"> </form> <?php $rrr=addslashes($_POST['myname']); $ddd="INSERT INTO pagination (`id`,`username`) VALUES('','$rrr')"; $ass=mysql_query($ddd); if($ass){ header('location: page.php?done=1'); exit; } //$perpage=6; //$ddw=mysql_query("SELECT COUNT (`id`) FROM `pagination`"); //$dqf=mysql_result($ddw,0); $sss="SELECT * FROM pagination"; $see=mysql_query($sss); echo "<table border='0' cellpadding='1' cellspacing='1'>"; while($row=mysql_fetch_assoc($see)) { echo "<tr><td>".$row['id']."</td></tr>"; echo "<tr><td>".$row['username']."</td></tr>"; } echo "</table>"; ?> it gives error header already sent correct me where i am wrong here is my connection file <?php $fff=mysql_connect('localhost','root',''); mysql_select_db('currency',$fff); ?> Link to comment https://forums.phpfreaks.com/topic/238852-header-already-sent-error/ Share on other sites More sharing options...
harristweed Posted June 9, 2011 Share Posted June 9, 2011 header('location: page.php?done=1'); Must be before any HTML out put. You have echo preceeding the header code! Link to comment https://forums.phpfreaks.com/topic/238852-header-already-sent-error/#findComment-1227299 Share on other sites More sharing options...
trq Posted June 9, 2011 Share Posted June 9, 2011 You must have missed the big sticky at the top of this board huh? Link to comment https://forums.phpfreaks.com/topic/238852-header-already-sent-error/#findComment-1227345 Share on other sites More sharing options...
Recommended Posts