The first thing I'd do is use variable names that are identical to the form names. It is easier to debug when $subject gets $_POST['subject'] instead of $header getting $_POST['subject'].
The second thing is that foreach($foo as $bar) is a loop. It takes an array $foo and assigns the current index to the variable $bar,performs the statements, and then increments the index.
The third thing is that PHP is case sensitive. $_post['subject'] is a different (and undefined variable) from $_POST['subject']. The rewritten code is below.
If you don't know about certain functions or about certain PHP structures, look at the PHP manual on PHP.net. It has a complete function reference and is a great resource.
Code:
<?
/************************************************** *************************
* mail.php
* -------------------
* Version : 0.1
* email : unknowngiver@gmail.com
* Warning: Dont copy my source or fbi will kick ur ***
************************************************** *************************/
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];
$id=$_POST['id'];
{
mail($id,$subject,$comments,"From: $email");
echo "Thanks for your comments.";
}
or die("There was a problem sending the mail. Please check that you filled in the form correctly.");
?> --Drew
P.S. This isn't any unique code; although you may want to "reserve your rights" as a copyright holder, this code has been written and rewritten many times: you have no idea. Don't bother with it. And also, don't get pissed off when people respond to your posts. It's bad etiquette toward those who are offering to help you. Such behavior only makes you look like a dumbass. Remember the old mantra, "don't kill the messenger."