Tag Archives: subscribe

PHP code to add and remove name from a text file

The code at http://pastie.org/2242460 is in response to a post @ REWARD: PHP code to add and remove name from a text file . This is an old post migrated from another domain as I think it would still be useful to some people.

I’d like to give users the chance to add and remove their names using a sign-me-up HTML form.
So they could “Thomas” to a text file with an HTML input box and then also remove themselves by choosing “remove” with a simple sign-me-up web form.
A bit like subscribing and unsubscribing from a mail list but the removal should search for the exact match in the text file (in upper or lower case) for the name “Thomas” and then say “you’re removed” or “you’re not on the list”.
Is this possible ? A whopping 200 points to the first decent working PHP script (plus 50 points for the best answer).
Thanks very much.