Hi Can somebody provide me a code to create a Subscribe to My Newsletter form. What I want is just a field where the user enters his email ID and click on the "subscribe" button. Once submitted he gets a thank you message either to his email address or instantly on the screen. And I should receive an email with the emailaddress of the subscriber. Thank you for your assistance.
If you would like to pay for it, send me a PM with all your details including design and i'll create it for you!
If I had to pay why would I post in this forum? See this reply on one of the earlier threads where someone offered to help.
Google for "free mailing list manager PHP scripts". There are many available. If you didn't do your homework properly, it was not unexpected if somebody offered paid help.
The form is easy... the rest might be a bit harder though. If you already have some sort of software that will send out emails, you can just set up something like this: <?php $name = $_REQUEST['name']; $email = $_REQUEST['email']; mail( "youremailhere@yourdomain.com", "Subject: add $email", "$name $email", "From: $email" ); ?> <form action="" method="POST"> Name: <input name="name"> Email: <input name="email"> <input type="submit"> </form>
Thank you so much Coffeesonnow. This is the kind of response I was looking for and not the other ones. If people do not want to help or looking for money, then they should go elsewhere. And for Rohan, why do you assume that I would not have done my homework. Just dont respond if you do not want to help.....it's just that easy.
It does work. But this is not what I was looking for. I do not want the subscriber to send an email, instead I want them to just enter their email in the text box and click on subscribe. It should then generate a "Thank You" and I should have the email stored in a file in my server. So If you can please provide me the code (front end - the form with just one text box and subscribe button) and all the other php codes, I would greatly appreciate that. I did look at several websites googling, but was not able to do it. Hence I came to this forum. Thanks for your help.
Yes my friend. I will create a text file called "email.txt" and all I need is the email ID's get stored there. Is this too much of a work for you ? sorry for the trouble and thank you so much for the help.
ok, this should work then <?php $name = $_REQUEST['name']; $email = $_REQUEST['email']; $emails = fopen("emails.txt","a"); fwrite($emails, $name." | ".$email."\n"); fclose($emails); ?> <form action="" method="POST"> Name: <input name="name"> Email: <input name="email"> <input type="submit"> </form>
Thanks a lot Coffeesonnow. Your help is much appreciated. Question: How does it get stored in the emails.txt. I downloaded the emails.txt from the server but did not find any email addresses there that I had tested. ? Also I have changed the permissions to emails.txt to full permission (CHMOD 777) And how can I add a "Thank you. Your email has been added to our Mailing list" appear on the screen. Take care
Ok, so when you used the form it didn't store the email? As for the message, just add if(isset($name)) { echo "Thank You ".$name.". Your email has been added to our mailing list."; } in between the <?php ?> tags somewhere.
I dont know what I might have done wrong.......but it is not working. Even the thank you message does not come up.
What php file? Am I supposed the place the above code in a file and then use the file name for form action. sorry my friend, I dont understand. php is alien to me....you got to walk me every step.
<?php // File Name $filename = "filename.php"; //Name $name = $_REQUEST['name']; //Email $email = $_REQUEST['email']; //Write To File $emails = fopen("emails.txt","a"); fwrite($emails, $name." | ".$email."\n"); fclose($emails); // If They've Filled Out The Form if(isset($name)) { // Tell them this. echo "Thank You ".$name.". Your email has been added to our mailing list."; } ?> <form action="<? echo $filename; ?>" method="POST"> Name: <input name="name"> Email: <input name="email"> <input type="submit"> </form> Put the above code in a php file, then in that top field where it says "filename.php" put the name of the file you've put the code in
Thank you so much my friend. But it does not work. See my next post. I thought you got tired of my questions and was not coming back.