/    Sign up×
Community /Pin to ProfileBookmark

e-Mailing List signup

Hi all,

I’m trying to figure out if there is an easy way to make a small form for mailing list signups on my web site. What I want to do is have form that is this simple:

Email Address field then below that a subscribe and and unsubscribe radio button then a submit button.

When the user enters their email in the field the radio button for subscribe is already selected and they hit subscribe and it sends that email address to the mailing list.

Does someone have code that i can use to do this? Please let me know. Thanks!

-Seth — Goldstein Media

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@crazy8Dec 14.2007 — Well I dont have any code but it does sound like what you are looking to do should be rather simple. It seems all you would need to do is make a small form with just one inputbox and two radio buttons and a submit button. Here is some pseudo code w/real code, maybe this may help you figure out what to do.

<form method="post" action="" ...>

<input name="email" type="text" size="50" maxlength="50">

<radiobutton "subscribe">

<radiobutton "unsubscribe>

<input name="submit" type="submit" value="submit">

<input name="remove" type="submit" value="remove">

</form>

<?php

if radiobutton "submit" is checked and $email box is filled out, then

INSERT INTO table_name (email_address) VALUES ($email);

else {

DELETE from table_name WHERE id = $email;

echo "Your email has now been removed from our list."

//maybe even do a redirect?

}

?>

I think that would be about it. Sorry I couldnt give you any solid working code but that shoud give you an idea, and get you started...besides its late for me now so its time to hit the sack. well hope this shines a little light onyour project. Good luck.
×

Success!

Help @goldsteinmedia spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...