Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3940600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:26:19+00:00 2026-05-20T00:26:19+00:00

Can anybody give me details on what to code into a page? Basically i

  • 0

Can anybody give me details on what to code into a page?

Basically i am required to build a mailing list from scratch where people can subscribe and they are added to a mailing list.

What would be the php/javascript behind it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:26:20+00:00Added an answer on May 20, 2026 at 12:26 am

    A mailing list is quite simple. You’d need to decide how you’d want to do it, but in general, you’d have a subscribe page and a post page. I am not testing this code, so it may contain flaws, but it should give you an idea of a flat-file based mailing list.

    In practical implementations, you should use MySQL, validate and confirm e-mails, check for errors and so on. Also, don’t forget that this does not authenticate the post page. You ideally need strong authentication to ensure your mailing list isn’t compromised. Additionally know that you -must- have an unsubscribe feature – this will be easier with MySQL than with flat-file.

    subscribe.php

    <?php
    // Has the form been posted?
    if(isset($_POST['email']))
    {
      // Append the submitted e-mail to the list.
      $file = fopen('list.txt', 'a');
      fputs($file, $_POST['email'] . "\n");
      fclose($file);
    
      // Send a message to the browser.
      die('Added to mailing list.');
    }
    ?>
    <html>
     <head>
      <title>Subscribe to Mailing List</title>
     </head>
     <body>
      <form action="#" method="post">
       <input type="text" name="email" />
       <input type="submit" value="Submit" />
      </form>
     </body>
    </html>
    

    post.php

    <?php
    // Has the form been submitted?
    if(isset($_POST['body']))
    {
      // This should load the file into $lines, as an array of, well, lines.
      $lines = file('list.txt');
    
      // For each line, send a message. $line should contain an e-mail address.
      foreach($lines as $line)
        mail($line, $_POST['subject'], $_POST['body']);
    
      // Send a message to the browser.
      die("Message delivered.");
    }
    ?>
    <html>
     <head>
      <title>Post to Mailing List</title>
     </head>
     <body>
      <h1>Post</h1>
      <form action="#" method="post">
       <input type="text" name="subject" /><br/>
       <textarea name="body"></textarea><br/>
       <input type="submit" value="Submit" />
      </form>
     </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody give an example of c++ code that can easily convert a decimal
Can anybody give me some clue that how to convert binary string into a
Can anybody give me some sample source code showing how to connect to a
Can anybody give me a code which would return full path to System32 directory
I am trying to make a 2D byte array. Can anybody give the code
Can anybody give me more details on this? I know that tap is coming
Can anybody give me some links or explain me how to build an XLL
Can anybody give me an example how to use the osgi framework classes? I
Can anybody give a link for a simple explanation on BFS and DFS with
Can anybody give me a direction, I want to know how to do auto

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.