transmitstudio
9/19/2016 - 11:13 PM

HTML and php Code for a simple Subscribe Form If you have PHP installed on your web server use the following code for a simple php subscribe

HTML and php Code for a simple Subscribe Form If you have PHP installed on your web server use the following code for a simple php subscribe (mail) form. https://www.arclab.com/en/kb/php/html-subscribe-mail-form-with-php.html

<?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 - WE ALSO USE THE RECIPIENT AS SENDER IN THIS SAMPLE
# DON'T INCLUDE UNFILTERED USER INPUT IN THE MAIL HEADER!
$sender = $recipient;

# 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: $sender" ) or die ("Mail could not be sent.");

## SHOW RESULT PAGE ##

header( "Location: $location" );
?>
<form method="POST" action="enter the URL to your PHP script 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>