Just so you know, my whole site is written in HTML but all the page extensions end in PHP because I use PHP to call the header and footer of my site. Anyhow, I am trying to get the user to input an email address into a text box. The text box form looks like this:
Code: Select all
<form action="/blog_features/newsletter_mail.php" method="post" name="newsletter" id="newsletter">
<input type="hidden" name="m" value="1101275763224">
<input type="hidden" name="lang" value="en">
<input type="hidden" name="loginName" value="name">
<input type="hidden" name="loginPassword" value="password">
<input type="hidden" name="ic" value="frontpage_signups">
<input type="text" name="ea" size="20" maxlength="50" value=""><br />
<input type="submit" value=" Sign Me Up! " id="submit" class="active">
</form>1) Put the hidden input fields loginname, loginpassword, ic and user provided ea field into a database located on a DIFFERENT server that MUST be accessed via a script
2) Email the admin, alerting him that he has a new subscriber
3) Email the new user, letting them know they have been successfully added to the mailing list
4) Dump the user onto a thank page via a redirect
This is the code I've come up with so far to do this:
Code: Select all
<?php
// variables passed from header.inc.php for constant contact script
$email = $_REQUEST['ea'];
$login_name = $_REQUEST['loginName'];
$login_password = $_REQUEST['loginPassword'];
$interest_group = $_REQUEST['ic'];
// variables to send howard a new user signup confirmation email
$howard_address = "john.serrao@humanproductivitylab.com";
$howard_body = "Howard, Some guy with ".$email" for an email address just signed up. He was automatically added to the constant contact system in the interest group 'frontpage_signups.' If you wish to change his interest group, login to the constant contact system, choose the 'Subscriber & Lists' tab > Interest Groups. THIS IS AN AUTOMATICALLY GENERATED EMAIL - DO NOT RESPOND.";
$howard_subject = "HPL SYSTEM UPDATE: Newsletter Signup Notification";
// variables to send new subscriber a confirmation email
$newsubscriber_address = $email
$newsubscriber_body = "You have been successfully added to the HPL's newsletter list 'The Art of Productivity.' Thank you for your support, HSL"
$newsubscriber_subject = "Thank you for signing up for the HPL newsletter!"
//plug variables from header.inc.php into the form
########dont know how to do this part############
// send emails to howard and new subscriber
mail ($howard_address, $howard_subject, $howard_body);
mail ($newsubscriber_address, $newsubscriber_subject, $newsubscriber_body);
// redirects user to 'thank you' page
header( "Location: http://www.humanproductivitylab.com/blog_features/thank_you.php" );
?>If it helps you, the script is located at:
http://ccprod.roving.com/roving/wdk/API ... isitor.jsp
(it is not my script, but i have tested it and it works very well)
If you can help me, let me know
john