How to create a "subscribe to email" type function on a site.

Posted on 2007-10-06
Last Modified: 2010-04-06
Hi there,

I have basic html/css/limited php knowledge. I'd like to include the functionality for someone to fill out a form requesting to be added to an email recipient list. I'm looking for guidance and suggestions. I'm hoping to keep it simple.. but I don't know if thats possible. :)

Question by:robyndorn
    LVL 28

    Expert Comment

    How do you plan to keep the list of registered user? In a mysql database may be?
    LVL 1

    Author Comment

    Yep, mysql would work for me, however I'm wondering how easy it is to extract the info out again in order to use the list? Is there a way to perhaps have an admin page that will display the list in a text format to copy and paste into an email or something? I don't know. I'm kinda blind in this area and just looking for advice.
    LVL 5

    Accepted Solution

    This will store requests in requests.txt, as admin open the page file.php?admin=adminpassword:

    if($_GET['admin'] == 'adminpassword') {
      echo "<pre>".file_get_contents('requests.txt')."</pre>";
    elseif($_POST['email']) {
      fwrite($h,$_POST['email'].';'.$_POST['msg'].';'.date('Y-m-d H:i:s'));
      echo "Successfully added.";
    else {
    <form method="post">
    Email: <input type="text" name="email">
    Message: <textarea name="msg"></textarea>
    <input type="submit">
    LVL 28

    Expert Comment

    Actually you couls write a script to automatically send the email to everybody registered in the database, although you could also have a list of all the users and do a copy and paste but this will become very tedious if your list grows to a few hundred users

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now