1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    St.JOhn's, Newfoundland, Canada
    Rep Power
    I need an easy php3 script that will allow a visitor to a website to enter their email address. This email address would be saved in a mysql database. I also need a script that would allow the administrator to view all in the list via a website, and also have the ability to email all in the list. Is this possible, if so can someone please give me these scripts.

    the fieldname for the email address would be memberemail

  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Laurens, SC ,US
    Rep Power
    The way I do this is a process of three pages.

    First set up a page with a form to collect the Email address. Be sure to have the form action go to your next page with the pagename.php3?name=$input-variable.

    On the second page you assure you have input, insert the input into the database and send the user to the Third page, which is the thank you page. The user will never actually see the second page unless they don't have an entry in the form text box.

    Hope this makes sense and helps. There are also some scripts that will verify the input is in a valid email format but I haven't used them.

    Obviously you need a db table with field UserEmail varchar(100) or something like that. And a field to identify the record - username, a simple auto-increment field, whatever you like.

    echo "<form action="page-to-go-to-next.php3?UserEmail=$UserEmail" method="post">";
    echo "<table border ='x' width = 'x'>";
    echo "<tr><td align = right>";
    echo "Your e-mail address";
    echo "</td><td><input type="text" name="UserEmail" size="40"></td></tr>";
    echo "<tr><td colspan='2'><center><input type="submit" value="Send This Now">
    echo "</td></tr></table></form>";

    On "Page-to-go-to-next.php3"

    mysql_connect ('host','user','password');

    if ($UserEmail == "") {
    echo "You forgot to tell me your E-MAIL ADDRESS.";
    echo "Please go back and complete the order form.";
    mysql("your db name here","INSERT INTO Table-Name VALUES ('$UserEmail')");
    Header("Location: $thankyou-page.php3");

    The third page can just say thanks or give a navigation menu or whatever.

    Thanks for the help.

IMN logo majestic logo threadwatch logo seochat tools logo