Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Quick Programming Help (https://www.warriorforum.com/programming/205271-quick-programming-help.html)

Social Experts 24th April 2010 10:39 AM

Quick Programming Help
 
Hey I have a website perfectballhandling.com and I want the user to be able to press the get updates button enter their email and it saves to mail.php on my server. can you tell me what i'm doing wrong?

senderbot 24th April 2010 11:39 AM

Re: Quick Programming Help
 
Hi,

Its probably something to do with your mail.php file. Have you edited it to email the input to your email address?

If you are not sure you could post the mail.php content here and someone might be able to give you a better idea as to what you've done wrong.

Cheers

Max

Social Experts 24th April 2010 12:31 PM

Re: Quick Programming Help
 
what i want the site to do is save the email address's imputed to the mail.php file. so all the emails will be in the file

sovarn 24th April 2010 12:36 PM

Re: Quick Programming Help
 
Do you have a database like MySql? Or do you just want the emails emailed to you?

Social Experts 24th April 2010 12:56 PM

Re: Quick Programming Help
 
i just want the emails saved to mail.php. but if it's easier then yeah i'll have them emailed to me

apoorv.parijat 24th April 2010 01:38 PM

Re: Quick Programming Help
 
Create a 'email.txt' file and change it's permission to writable.
Place this script in mail.php

-----------------------------------------------------------------------
<?php
$fp = fopen('email.txt','r+');
if(!$fp)
{
echo "Create the file first.";
}else{
$present = FALSE;
while (!feof($fp))
{
$email = fgets($fp);
if ($_POST['email'] == trim($email)){
$present = TRUE;
}
}
if (!$present){
fwrite($fp, $_POST['email']."\n");
echo "Email :".$email.' added.';
}
fclose($fp);
}
?>
-----------------------------------------------------------------------

The only assumption in this script is that it expects 'email' in a post request.Make sure it receives one or edit the script to your needs.

The emails are stored in the 'email.txt' file you just created.
Let me know if you have a problem.

Social Experts 24th April 2010 02:13 PM

Re: Quick Programming Help
 
oh my god dude it worked! thanks :D!!!

apoorv.parijat 24th April 2010 02:31 PM

Re: Quick Programming Help
 
You are welcome mate. :)


All times are GMT -6. The time now is 02:05 PM.