juapo2 Posted December 23, 2007 Share Posted December 23, 2007 Hi, I have a site running on free web hosting. I have various powerful scripts but i need help coding something some people may say is easy... I need a form, where my users add their e-mail adress to receive newsletter, i just need them to write their e-mail adress, and make the e-mail adress go into a .txt file, something like emails.txt I dont need script to send the newslettter or to unsubcribe them, just that their email adress goes into the .txt file, I would appreciate if you could help, Thany YOU. Quote Link to comment Share on other sites More sharing options...
wolfrat Posted December 24, 2007 Share Posted December 24, 2007 Form to have on your page: <form action='addemail.php' method='GET'> <input name="email" type="text" /> <input name="submit" type="submit" /> </form> this php code should be in addemail.php (assuming the form above is used): <?php if (isset($_GET['submit'])){ $email = $_GET['email']; //adding a new line character so that each email address has its own line $email = "$email \n"; //opening the textfile for writing $textfile = fopen("emails.txt","a"); //writing the email fwrite($textfile, $email); //closing the textfile handle fclose($textfile); } ?> It's a very simple, basic script, but it will get the job done Quote Link to comment Share on other sites More sharing options...
juapo2 Posted December 24, 2007 Author Share Posted December 24, 2007 Thanks man, ill try it, ill tell you if it worked Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.