...

View Full Version : Adding recipients to newsletter



The reaper
03-31-2010, 05:02 AM
Hello again,

I'm trying to grasps some concepts of PHP. I rough coded a small newsletter system. Which you can see here http://forms.newestfunny.com/contactus.html

What I am trying to figure out is when a person wants to be added to the recipients list, they enter their email in a form and it automatically is added to the list on contactus.html. Is there a good way to approach this? Maybe tips, ideas?

Thanks for you help, and the read; it is much appreciated.

cfructose
03-31-2010, 08:23 AM
Two general ideas / questions to start with:

1) How will all the email address be stored? Are you going to use a MySQL database? Need any pointers in how to go about that?

2) Do you know anything about 'validating user input'? I'm referring to the idea that any data submitted by a user needs to be checked with a bit of code to make sure that you're actually receiving the type of data you expect.

Imagine that your form says "Enter email here", and that your code saves whatever they submit without checking that it was in fact an email address that they wrote. What if they were doing something malicious, and the supposed email address was actually a script designed to hijack your site?
So, at the very least, before saving the data, you'll want to check that what they've submitted doesn't contain any tags "<", ">" etc, and that it has a "@" in it.

masterofollies
03-31-2010, 02:25 PM
You need a database to hold all the emails. Also your page needs to be contactus.php

Once you have the database setup, you can quickly put a query in your form to add the email.

If you want a removal option, make another form, and when they type in their email address, have it check for that email in the database and do a query delete.

The reaper
03-31-2010, 03:11 PM
Thank you both for your replies:

@ cfructose
I guess I never really thought about how to store them! I don't have that much experience with MySQL but I do know the basic command lines for phpmyAdmin. I made a small test blog awhile ago and made the tables and databases for that. But nothing really fancy.
2) I believe I can do the email check, there is plenty of examples online that will check the email. Are these the right ones for this?

@masterofollies
Yes, hopefully I can get the database that both of you suggested and I'll definitely put in the delete option. Great idea!

Again thank you both and any help with the database would be awesome!
I'll continue to experiment and see what I can pick up for the database.

The reaper
03-31-2010, 03:22 PM
Did some research for the email validation, this is the easiest one I've found:
http://www.javascriptkit.com/script/script2/acheck.shtml

Does that work? I've never had to check before.

masterofollies
03-31-2010, 03:51 PM
I would be happy to help you code it, just make a database and input the following,


Field Name: id
type: smallint
value: 5
Extra: Auto Increment
default: (leave blank)


Field Name: email
type: text
value: (Leave blank, not valid with text)
Extra: (Leave blank)
default: (Leave blank)


That would be really simple structure, you could add ip address also so you can check if a person is entering a ton of different email addresses.

One last thing, also add some type of security field, type in the words or numbers. You don't need a big script, could just be like "Type in FIRE to continue".

The reaper
04-01-2010, 04:25 AM
Thanks a lot for that! I will start working on it tonight and tell you if I run into any problems. Thanks a lot, I really do appreciate it.

Len Whistler
04-01-2010, 05:54 AM
Yes, hopefully I can get the database that both of you suggested and I'll definitely put in the delete option. Great idea!

Instead of deleting emails from the database I would go with a "status" column and default value of "1" for on/active, if the the user wants to opt out then the "status" is updated to "0" for off/inactive.

1 = member receives newsletter / member in good standing
0 = member doesn't receive newsletter / member opted out or got banned.

Change "status" back to "1" and member is reinstated.



-------

Philip M
04-01-2010, 08:27 AM
I don't talk to the following people. Because they are disrespectful.

oracleguy
Excavator
drhowarddrfine
MattF
Apostropartheid
_Aerospace_Eng_
VIPStephan
Fumigator
Rowsdower!
WA

I am not paranoid! Which of my enemies told you that? :D:D

The reaper
04-01-2010, 01:37 PM
Ok the to databases are made. One is "newsletter, id" second is "emaillist, email"

So, the form action will be coded in PHP? What is the command to insert the info into the databases? And then pull them out for the checkbox newsletter form?

thanks again, please do not spend to much time if you don't have it. I appreciate greatly what you are doing!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum