Click to See Complete Forum and Search --> : e-Mailing List signup


goldsteinmedia
12-13-2007, 08:02 PM
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

crazy8
12-13-2007, 11:21 PM
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.