If you have
PHP installed on your webserver, then you can use the
following code for a simple PHP Subscribe (Mail) Form. You can
use the same code for Remove, just change the subject to the
remove-keyword ("Remove" by default).
Add the following code to your HTML page:
<form
method="POST" action="enter
the URL to your PHP page here">
<p>Name: <input type="text"
name="Name" size="20"></p>
<p>Email: <input type="text"
name="Email" size="20"></p>
<p><input type="submit"
value="Submit" name="Submit"></p>
</form>
Create a new PHP file (e.g. subscribe.php) with any
texteditor (e.g. notepad) and place it on your webserver.
Please update the URL in the HTML
form. (e.g. subscribe.php)
<?php
## CONFIG ##
# LIST EMAIL ADDRESS
$recipient = "enter the lists email
address here";
# SUBJECT (Subscribe/Remove)
$subject = "Subscribe";
# RESULT PAGE
$location = "enter the URL of the
result page here";
## FORM VALUES ##
# SENDER
$email = $_REQUEST['Email'] ;
# MAIL BODY
$body .= "Name: ".$_REQUEST['Name']." \n";
$body .= "Email: ".$_REQUEST['Email']."
\n";
# add more fields here if required
## SEND MESSGAE ##
mail( $recipient, $subject, $body, "From: $email" )
or die ("Mail could not be sent.");
## SHOW RESULT PAGE ##
header( "Location: $location" );
?>
Now save both files to your webserver and click on
"Submit".
The php script will not work on your local computer - please
upload it first.
|