Possible Duplicate:
“Warning: Headers already sent” in PHP
I have a php page which when i fill out email filed and press enter it connect to the mail.php in this page after sending mail i want to go back to the page that i was but it gives me this error :
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/users/teachers/mail.php:3) in /home/mysite/public_html/users/teachers/mail.php on line 15
this is the mail.php code :
<html>
<body>
<?php
$email = $_GET['email'] ;
$subject =$_GET['author'] ;
$message = $_GET['text'] ;
$to = "mail@mail.com";
$from = $email;
$headers = "From:" . $from;
mail($to,$subject,$message,$headers,$from);
?>
<script language="javascript">
alert('your mail has sent !');</script>
<?php
header('location:../teachers/index.php');
?>
</body>
</html>
what should i do ?