Either header.php
or connection.php
are outputting some content. You cannot modify the HTTP headers after content is sent, because the headers have already been sent at that point.
A hack of a solution would be this:
<?php
ob_start();
require 'header.php';
require 'connection.php';
mysql_query("DELETE FROM quotes WHERE ID = $_GET[id]") or die("didnt delete properly");
header('Location: index.php');
ob_end_flush();
?>
However, you should instead figure out where content is being sent and suppress it, or reorder it to come after the header()
call.
If, as I suspect, header.php
outputs an HTML header, you can just eliminate the require 'header.php';
line -- the content will never be shown anyway, since this is a redirect.
Also, note that the HTTP standard requires that the value of a Location header be an absolute URL. Therefore, header('Location: index.php');
will generate an HTTP response that is invalid according to the HTTP standard.