Updating mysql db. This page get an id via page post. The Textfield "Links" could be changed and submitted. After the submit, there's a mysql update on the ID and after the update the page should redirect to dbedit.php. but i get a:
Cannot modify header information - headers already sent on line 13.
I have no idea why? and can't find any output before the "header()" to the user. Where's my mistake?
<html>
<body>
<?php
include('config.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];
if(isset($_POST['submit']))
{
$Links=$_POST['Links'];
$query3=mysqli_query($link, "update posts set Links='$Links' where id='$id'");
if($query3){
header('location:dbedit.php');
}
}
$query1=mysqli_query($link, "select * from posts where ID='$id'");
$query2=mysqli_fetch_array($query1);
?>
<form method="post" action="">
Name:<input type="text" name="Links" value="<?php echo $query2['Links'];?>"/>
<input type="submit" name="submit" value="update" />
</form>
<?php
mysqli_close($link);
};
?>
</body>
</html>