use of header function
i want to delete data from database by clicking a link named "Delete".I want to do it,just by clicking not after refreshing the page. My table and another code including links one,is on a page named "editordeletedata" and the mysql query is on another page named "delete". For this i want to use header function in my delete page. But it shows:
Warning: Cannot modify header information - headers already sent by (output started at C:开发者_StackOverflow中文版\xampp\htdocs\www\php everyday site tutorials\delete.php:2) in C:\xampp\htdocs\www\php everyday site tutorials\delete.php on line 13
Please tell me the correct use of header function or any other way.
editordelete page: contain a link named "Delete"
delete page :
<p> <title>delete</title> </p>
<?php
include "include.php";
?>
<?php
if(isset($_GET['id']))
{
$order = "DELETE FROM employee WHERE id='$_GET[id]'";
mysql_query($order) or die (mysql_error());
}
header("Location: editordeletedata.php");
?>
something is being printed before header function call. If nothing apparently then it must be a space. delete all spaces being printed. convert it into hex format to check where are those spaces creating problem.
精彩评论