I know I can use CGI scripts for that but I'm wondering if this can't be done in PHP?
I want to create a form that collects data from users willing to subscribe to my mailing list and sends me an email with that data.
Let's start with something simple. Let's learn how to create a form with one field, "name", and one button, "submit". When a user click on submit, I want to receive an email with the name he filled out in the form.
So far, I have created a form on one page:
<form action="action.php" method="post">
Your name: <input type="text" name="name">
<input type="submit">
</form>
And then, the "action.php" page sends me an email using the php function mail(), like so:
<?php
mail("me@mydomain.com", "Subject", "Message");
?>
My question is: how do I include the variable "name" into the message of the email???! How do I "pass" that var from the form page to the action.php page?
Thanks!