so im learning php (begginer if you cant tell) and, im currently pushin/pulling data from the db to a page so that it can then populate other parts of the page and when “send” is hit, it puts it all together and sends right…
my question is,
i know to set for example:
$to = 'email@gmail.com';
$subject = 'test from my email php script';
$email = $_POST['email'];
$name = $_POST['fname'];
$lastname = $_POST['lname'];
$mssg = $_POST['mssg'];
but how does php or the mail app on the server know which field goes where since these are
self made variables???
so for example if i say:
mail($to, $subject, $name, $lastname, $mssg);
how does it know to put say “subject” in the emails subject area and not all together in the mesage field etc?
i have a few pages open but none explain the WHY or better et, the HOW
thanks in advance.
The mail() function expects your arguments to it to be in a certain order, so that it knows which values are for what. Then it builds the proper email headers based on what you gave it, and passes it to the email server to send off.
p.s. – your example is wrong. mail() would return an error because of that. Take a look at the manual entry for mail() to see what it expects and where http://www.php.net/manual/en/function.mail.php