Click to See Complete Forum and Search --> : newsletter


chriscam19
03-09-2003, 12:49 PM
I want to build a newsletter for my site but I am new to it! Is it easy to write a newsletter script in HTML or Javascript? Or do I have to sign up for a service? If it is easy can someone point me to a link that tells me how to write a newsletter script?

What i want is for people to come to my site, enter in there email address, and then I can store the email address and send them a newsletter every month

chriscam19
03-09-2003, 12:55 PM
what is server side code?

Nevermore
03-09-2003, 01:33 PM
Its code which you (normally) put in the HTML document just as you would JavaScript. However, the code executes on the server not on the 'client' - the user. This lets it store information on the server instead of just as cookies. The advantages and Drawbacks are:

+ Can store information
+ More secure
+ Can call infor from serve
+ User needs no plug ins

- Slower
- No good for games etc. because server has to process everything
- Must be installed on server to be usable.

Examples of Server-Side Code include: PHP, ASP and server-side JavaScript. If they are installed, you could very easily make a newsletter script in PHP and MySQL, both of which are free. If you need anymore help, I know a lot of PHP and MySQL, and Dave knows even more. (or is a good actor)

chriscam19
03-09-2003, 01:42 PM
yes i need more help, i know nothing of those languages. I need to set up a newsletter. can you walk me through it!

Nevermore
03-09-2003, 01:45 PM
Do you know if your server supports PHP and MySQL?

chriscam19
03-09-2003, 01:54 PM
yes it does, supports both

Nevermore
03-09-2003, 02:11 PM
If you need any help with any of this, just say so.

First things first. You will need a table in MySQL with the columns:
id, firstname, lastname, email.

The ID column needs to be set as unique, primary key and auto_increment. They all need to be not_null.

Then you will need an input form. I have prepared a very simple noe - feel free to expand on it:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Sign up for our Newsletter</title>
<style type="text/css">
#labels {
position:absolute;

line-height:1.5;

}
#inputs {
position:absolute;
left:8em
}
#all {
position:absolute;
top:75;

}
</style>
</head>

<body>
<h1 align="center">Sign up for our Newsletter</h1>
<form action="news.php" method="POST">
<span ID="all">
<div ID="labels">
<LABEL for="first">First Name</LABEL><br>
<LABEL for="last">Last Name</LABEL><br>
<LABEL for="email">Email Address</LABEL><br>
</div>
<div ID="inputs">

<input name="first" id="first" class="values" type="text" value=""><br>
<input name="last" id="last" type="text" class="values" value=""><br>
<input name="email" id="email" type="text" class="values" value=""><br>
</div>
<span>
</form>

</body>
</html>

Next, you need the PHP script to actually insert the information. Here's mine. Please note that this does not validate anything.


<?php
if ($email) {
$first = addslashes($first);
$last = addslashes($last);
$username="";
$password="";
$database="";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

//gets id
INSERT INTO newsletter (id, firstname, lastname, email) VALUES ("", $first, $last, $email);
mysql_close();
}
?>


If this will initiate any processing by the server that could be a security risk, can someone please mention it. I'm pretty sure it won't, but its always better to have a second opinion (Dave?)

Once you've uploaded these two pages, you should be able to add email addresses. Do you need a script to send the emails too?

chriscam19
03-09-2003, 02:23 PM
yes i need a script to send the emails too. but first let me get the MySQL table and PHP in tack. I am putting the MySQL table in right now.

chriscam19
03-09-2003, 02:50 PM
i dont think i know what i am doing. this is harder than i thought!

chris

Nevermore
03-09-2003, 03:05 PM
What do you need help with?

chriscam19
03-09-2003, 03:14 PM
i want the customers to be able to goto my site, enter in their email address if they choose so, then somewhere their email address get stored in a database. then I can take that data base of emails and send them a newsletter.

Maybe i am out of my league. I cant figure out where to start first. I dont know how to enter the MySQL code.

should I just sign up for a newsletter and pay for it?

chris

Nevermore
03-09-2003, 03:17 PM
No - thats a waste of your money. There are free tools to help you make your table. Do you know your username and password for mySQL? If you do, this tool should help:
http://www.phpmyadmin.net/index.php?dl=3

Log in to it, and it should help you to make a table. Just look for the option - you dont have to write any code at all.

chriscam19
03-09-2003, 03:17 PM
actually if i could just get a script that will send me their email I can take the emails and record them myself and send them a newsletter myself

chris

Nevermore
03-09-2003, 03:19 PM
If you use the program to make the table, all you have to do is upload the pages and its made. I can even give you a PHP file that will make the table if you know:

the database name
username
password

Nevermore
03-09-2003, 03:32 PM
Just insert the database name, username and password into this script, save it as a PHP and visit it on the server to create the necessary table. Then delete the PHP file.

<?php
$username="";
$password="";
$database="";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

CREATE TABLE `newsletter` (
`id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`firstname` VARCHAR(255) NOT NULL,
`lastname` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
INDEX (`id`),
UNIQUE (`id`)
);
?>

chriscam19
03-09-2003, 03:35 PM
can you do it for me if i give you all that info?

Nevermore
03-09-2003, 03:36 PM
You probably don't want to give out passwords etc - but if you just insert them into the script above, it will do everything for you.

webby
03-11-2003, 02:30 AM
listen to cijori

Nevermore
03-12-2003, 02:00 PM
Webby - you know NOTHING about this. Can you PLEASE stop posting for no reason after all my posts!!!

Nevermore
03-14-2003, 03:21 PM
Do you need more help, or is that enough?