HighDots Forums  

Probs with craeting a subscribe form with PHP

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Probs with craeting a subscribe form with PHP in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rakky76
 
Posts: n/a

Default Probs with craeting a subscribe form with PHP - 02-20-2008 , 08:53 AM






Here is my page with the form on -
http://willowdragonadventureclub.co.uk/index.htm

The PHP code is attached to this message.

Or does anyone know a real easy, simple way of creating a subsription form?

<?PHP

DEFINE('kOptional', true);
DEFINE('kMandatory', false);

error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('track_errors', true);

function DoStripSlashes($FieldValue)
{
if ( get_magic_quotes_gpc() ) {
if (is_array($FieldValue) ) {
return array_map('DoStripSlashes', $FieldValue);
} else {
return stripslashes($FieldValue);
}
} else {
return $FieldValue;
}
}

#----------
# FilterCChars:

function FilterCChars($TheString)
{
return preg_replace('/[\x00-\x1F]/', '', $TheString);
}

#----------
# Validate: Email

function check_email($email, $optional)
{
if ( (strlen($email) == 0) && ($optional === kOptional) ) {
return true;
} elseif (
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$",
$email) ) {
return true;
} else {
return false;
}
}



if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}

$FTGtextfield = DoStripSlashes( $_REQUEST['textfield'] );
$FTGemail = DoStripSlashes( $_REQUEST['email'] );
$FTGSubmit = DoStripSlashes( $_REQUEST['Submit'] );


# Fields Validations

$ValidationFailed = false;

if (!check_email($FTGemail, kMandatory)) {
$ValidationFailed = true;
}


# Redirect user to the error page

if ($ValidationFailed === true) {

header("Location: http://willowdragonadventureclub.co.uk/whoops.htm");
exit;

}
# Email to Form Owner

$emailSubject = FilterCChars("subscribe");

$emailBody = "textfield : $FTGtextfield\n"
. "email : $FTGemail\n"
. "Submit : $FTGSubmit\n"
. "";
$emailTo = 'Steve <contact (AT) willowdragonadventureclub (DOT) co.uk>';

$emailFrom = FilterCChars("contact (AT) willowdragonadventureclub (DOT) co.uk");

$emailHeader = "From: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: 8bit\n";

mail($emailTo, $emailSubject, $emailBody, $emailHeader);


# Redirect user to success page

header("Location: http://willowdragonadventureclub.co.uk/thanks.htm");
exit;
?>


Reply With Quote
  #2  
Old   
JLRS13
 
Posts: n/a

Default Re: Probs with creating a subscribe form with PHP - 04-01-2009 , 10:05 AM






I'm new in web design.

Your form receive the email's user of the webpage ?

Thanks

JLRS - MX

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.