View Single Post
  #2  
Old 06-10-2009, 05:46 PM
Anabass
Guest
 
Posts: n/a
Default Simple Newsletter script

I need to have some newsletter form on my web, where you can subscribe it, so probably it will be usefull for the others. It is very simple and has two forms: first is the e-mail and I added additional, that is the category (of the newsletter). The source code is:

Code:
<form action="send.php" method="post" name="form2">
<input type="text" size="20" name="emailaddr" value="@"><br><br>
<input type="text" size="20" name="category" value="vsetko"><br><br>
<input type="submit" value="Odoslať/Submit">
</form>
This is the code, that you import to your HTML file. Than you need to create independent file named "send.php", where you will write:

Code:
<?php
$to = "youremail@youremail.eu";
$useremail = $_POST['emailaddr'];
$category = $_POST['category'];
$subject = "Subject of the email";
$message1 = "Email: ".$useremail;
$message2 = "Kategória: ".$category;
mail($to,$subject,$message1,$message2);
header("Location: ./index.htm");
?>
And it should look like this (of course I added also the text and the picture):

Reply With Quote