View Single Post
Old 03-18-2002, 12:34 AM  
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Quote:
Originally posted by sexyavs
brujah,


I remember someone asked you about a 4 lines of php code that will allow users to submit their email address and save it to a file or soemthing?

You still have that?

Make a form like this one
<form action="collect.php" method="post">
<input type="text" name="email"><br />
<input type="submit" value="Subscribe">
</form>

Then a php file named collect.php like this:
Code:
<?php
if ( eregi( '^[-!#$%&\\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email )  )
{
    $fp=fopen('email.txt','a+');
    if($fp) {
        fwrite($fp,"$email\n");
        fclose($fp);
    }
}
?>
You'll need a file like 'email.txt' with permission to write to it.
There isn't a lot of validation, but it'll log all the email addresses being entered.
__________________

Last edited by Brujah; 03-18-2002 at 01:27 AM..
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote