PHP
  Home arrow PHP arrow Page 4 - Creating a Mailing List Manager with PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Creating a Mailing List Manager with PHP
By: Duncan Lamb
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 44
    1999-12-16


    Table of Contents:
  • Creating a Mailing List Manager with PHP
  • Creating the front page
  • Adding names to the list
  • Editing the names
  • Autoresponders
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Creating a Mailing List Manager with PHP - Editing the names
    ( Page 4 of 6 )


    To edit the names, we’ll use a crude but effective method: direct editing! Incorporating the editing into a form will make it less daunting, however. Observe the following code:

    First, the user should pick the list to edit:

    picklist.php3

    <html><head><title>Pick the list</title></head><body> <center> <br><br> Please pick the list you would like to edit: <br> <form method=post action="editnames.php3"> <select name="List" size=4> <? $fileloc = "lists.txt"; $groups = file("data/lists.txt"); for ($index=0; $index < count($groups); $index++) { $grouplist = split("\|", chop($groups[$index])); ?> <option value="<? echo $grouplist[1] ?>" <? if ($index==0) {echo "selected";} ?>> <? echo $grouplist[0] ?><br> <? } ?> </select> <br><br> <input type="submit" value="Edit list"></form></center> </body></html>
    Then, a form is created to allow editing and deleting of the names:

    editnames.php3

    <html><head><title>Edit Maillist addresses</title></head><body> <form method=post action="writenamefile.php3"> <br> Editing <? echo $List ?>. <br><br> Fix an address by editing in place, or delete an address by deleting the WHOLE line. <b>No blank lines or spaces allowed! </b> <br><br><textarea cols=50 rows=20 name="Body"> <? if (file_exists("data/$List")) {readfile("data/$List");} ?> </textarea> <br><br> <input type="hidden" name="List" value="<? echo $List ?>"> <input type="submit" name="submit" value="Save This List"></FORM> <br><br><a href="addnames.php3">Add names to the list</a>. <br><br><a href="data/log.txt">View Send Log</a>. <br> </body></html>
    The readfile function (line 8) reads in a file and directly sends in to the browser. This places all the addresses for the specified list into a textbox, where they can be deleted or fixed directly. Also, note the warnings about one address to a line, something to remind the administrator about what’s right and wrong. The next script saves all the changes:

    writenamefile.php3

    <html><head><title>Updating file....</title></head><body> <br><br> Changes saved to <? echo $List ?>.<br> <? $myfile = fopen("data/$List","w"); fputs($myfile,$Body); fclose($myfile); ?> <br> <a href="index.php3">Home.</a> </body></html>
    This was just as easy as reading the file in! Since the whole list was in the textbox, it is all included in the variable $Body, newlines and all. Writing $Body to the file saves the entire thing exactly as it looked in the previous form.

     
     
    >>> More PHP Articles          >>> More By Duncan Lamb
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT