Forum Moderators: coopster

Message Too Old, No Replies

Mailing List Making

         

kurtlane

7:02 am on Aug 7, 2009 (gmt 0)

10+ Year Member



Hello,

I am trying to make a mailing list that stores all the people who subscribe into a text file, Thats done, mainly becuase i dont have any mysql databases, i would like to use phplist but cant. I have a current subscribers page here

[code]<h1>Current Subscribers To the Email List</h1>
<script type="text/javascript">
function CopyToClipboard()
{
CopiedTxt = document.selection.createRange();
CopiedTxt.execCommand("Copy");
}
</script>
<p><form name="select_all"><input type="button" value="Select All" onClick="javascript:this.form.subscribers.focus();this.form.subscribers.select();">&nbsp;<input type="button" onClick="CopyToClipboard()" value="Copy To Clipboard" />&nbsp;<input id="Save" type="button" value="Save Changes" onclick=""/>
<br /><br />
<textarea name="subscribers" cols="40" rows="20"><?php include("emaillist.txt"); ?></textarea>
</form>[code]

It displayes a textarea with the contents of the text file in it. All good, but i added a button that is called save and i want to make it so when its clicked, any changes to the text area are written back to the text file, so i can manage the list from that page, remove email addresses etc.
Can someone get me started on that function please,

Write the contents of the textarea to the textfile emaillist.txt when the button Save is clicked.

Thank you.

jatar_k

5:34 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you need only a couple of functions

fopen [php.net]
fwrite [php.net]
fclose [php.net]

open the target file for writing using fopen
then send the contents of the textarea, which should be in the $_POST array, to the file using the fwrite function
close the file pointer using fclose

and that's it