Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Simple Newsletter Subscription Form 1

Status
Not open for further replies.

BooYaKaSha

Technical User
May 18, 2002
62
US
Hello -

I am doing a pro-bono project for a Christian organization. They want a weekly newsletter that users can subscribe to. Cause it's free, I really don't have the resources available -- and time is critical right now -- to learn how to do this right. I just need a quick how-to.

Here goes. I have a mass email program that can recognize email with "Subscribe" in the subject line and automate everything else. I just need a small, two-field form with a submit button on a web page:

Field 1 - Name
Field 2 - Email Address
Button - Subscribe

When the user clicks subscribe, I need an automated script that will do the following:

1 - Generate a new email message with:
a. "Subscribe" in the Subject line
b. "NAME=(Field 1)" in the body
c. "EMAIL=(Field 2)" in the body
2 - Send the email to "newsletter@myDomain.net" without using the submitter's email (?).

Cause of all the inherent issues involved, I really don't want to use a standard "POST" for submitting the form. I have been using Javascript / DHTML / Flash for some time, but I am new to server-side stuff.

More info: The hosting company uses PHP & ASP (but not ColdFusion). I do not have a testing server set up on my computer, but will do so if this is necessary. I don't really need a database to store this stuff, since my email prog will store the information here.

Thanks a million in advanced for anyone's help. You are truly a lifesaver if you can help me.

Peace.
 
hay mate you still looking for an answer to this?

You are best posting in the php section or somthing but post back if you still need help and i can help you out.
 
Does the host support cdonts or jmail etc.. ?

What you trying to achieve is relatively simple depending on your host options.

Cheech

[Peace][Pipe]
If you don't stand up for something, you'll fall down. Toke it Easy.
Howard Marks.
 
OK, I just called the hosting company, and they said I have to use CGI sendmail....They don't have the two you mentioned...

Does this work for the task at hand?
 
did you not say that the server had php?

ok try this ode.....just pop it into one of your pages

<?php
if ($subscribe != &quot;true&quot;) { ?>

<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;<?php print&quot;$PHP_SELF?subscribe=true; ?>&quot;>
<input name=&quot;name&quot; type=&quot;text&quot; id=&quot;name&quot;>
<br>
<input name=&quot;email&quot; type=&quot;text&quot; id=&quot;email&quot;>
<br>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Subscribe&quot;>
</form>

<?php }

elseif (subscribe == &quot;true&quot;) {
if (($name != &quot;&quot;) AND ($email != &quot;&quot;)) {
$recipient = &quot;newsletter@myDomain.net&quot;;
$subject = &quot;Subscribe&quot;;
$message = &quot;$name
$email&quot;;
$extra = &quot;From: Website <website@myDomain.net>&quot;;
mail ($recipient, $subject, $message, $extra);
print (&quot;Thank you $name, you have now subscribed to the newsletter&quot;);
}else{
print(&quot;Your have not filled in all the form please use browser back button to go back to form!&quot;);
}
}
?>

it is untested, let me know how it goes
 
ahhh ooops
in the elseif bit change this line

elseif (subscribe == &quot;true&quot;) {
to this
elseif ($subscribe == &quot;true&quot;) {
 
Everyone:

Thanks for the replies. Tek-Tips was down for a while, so I couldn't respond. I did find a free script (Matt's Form Mail) that did the trick.

Thanks for taking the time to help me though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top