/    Sign up×
Community /Pin to ProfileBookmark

simple mailing list

hi ive got this counter code which i would like to modify for use with a mailing list, however im not to good with php scripting yet. 😮

I have a form containing a text box and a submit button. The browser enters their email and submits the form. What i want the code to do is take this entered email address, open a text file cheak if the email is already there (if so close text file) and add it to a list and adding <, > and a , each email is on a new line. e.g.
[B]<[/B][email protected][B]>,[/B]
[B]<[/B][email protected][B]>,[/B]

this is my form code:

[CODE]<form method=”POST” action=”http://{$_SERVER[‘HTTP_HOST’]}{$_SERVER[‘PHP_SELF’]}”>
<p style=”margin-top: 1; margin-bottom: 1″><input type=”text” name=”Email” size=”15″ style=”color: #000000; font-family: Arial; font-size: 11px” value=”$value”>

<input type=”submit” value=”Join” name=”B1″ style=”color: #000000; font-family: Arial; font-size: 11px”></p>
</form>[/CODE]

this is the counter code:

[CODE]<?php
//this is our text file if you create a different named file change the script below to reflect this
$counter_file = (“counter.txt”);
//now we open the file
$visits = file($counter_file);
//this increments the counter value by 1
$visits[0]++;
//now we will open the counter file for writing “w”
$fp = fopen($counter_file , “w”);
//put the new count value into the counter file
fputs($fp , “$visits[0]”);
//close the file
fclose($fp);
?>[/CODE]

Help would be much appriciated! ?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @james_d_kelly spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...