[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

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

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. :)

Cheers
0
robyndorn
Asked:
robyndorn
  • 2
1 Solution
 
gamebitsCommented:
How do you plan to keep the list of registered user? In a mysql database may be?
0
 
robyndornAuthor Commented:
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.
0
 
frinCommented:
This will store requests in requests.txt, as admin open the page file.php?admin=adminpassword:

<?php
if($_GET['admin'] == 'adminpassword') {
  echo "<pre>".file_get_contents('requests.txt')."</pre>";
}
elseif($_POST['email']) {
  $h=fopen('requests.txt','a');
  fwrite($h,$_POST['email'].';'.$_POST['msg'].';'.date('Y-m-d H:i:s'));
  fclose($h);
  echo "Successfully added.";
}
else {
?>
<form method="post">
Email: <input type="text" name="email">
Message: <textarea name="msg"></textarea>
<input type="submit">
</form>
<?php
}
?>
0
 
gamebitsCommented:
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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now