Forum Moderators: mack
I use them in a couple of my websites - they work a treat, and you wouldn't have to be greatly experienced with php to understand.
I'll use a small example of the code I use for my mailing list page.
mailinglist.html<form action="index.php?get=mailinglist.php" method="POST">
<input class=textarea name="email" size="40">
<input class=button type="submit" name="submit" value="Join">
</form>
Then, as you know, once the user has submitted their information they're redirected to the page stated - in this case 'mailinglist.php'
mailinglist.php<?
$email = $_POST['email']; // this gets their email from the previous page
$myemail = "myemail@mywebsite.co.uk"; // this is the email it is being sent to
mail($myemail, "email topic", "Email: $email"); // this is the topic of the email when recieved, and how it will appear
?>
<h1>Thank You:</h1>//thanks message
<p>You are now sucsessfully added to the mailing list, thank you for joining.</p>
The way to set up what you see in the email is easy too.
You get what you want to see in the email and you get what they wrote, in the above I used the example.
Email: $email
So that will appear as
Email: theiremail@theirdomain.com
To add more is really easy, you just repeat the commands.
Example:
Email: $email\n Other Field: $other\n
\n represents a new line. In the recieved email you would see it as
Email: theiremail@theirdomain.com
Other Field: other thing?
I hope I have helped.