![]() |
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? |
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 |
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 |
Re: Quick Programming Help Do you have a database like MySql? Or do you just want the emails emailed to you? |
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 |
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. |
Re: Quick Programming Help oh my god dude it worked! thanks :D!!! |
Re: Quick Programming Help You are welcome mate. :) |
| All times are GMT -6. The time now is 02:05 PM. |