You are here: Re: HELP! Trying to add Email Notification to Download File Code « PHP Programming Language « IT news, forums, messages
Re: HELP! Trying to add Email Notification to Download File Code

Posted by matt on 11/11/06 01:26

Pedro Graca wrote:
> matt wrote:
>
>>I have used some free code for listing files for download, but I want to
>>send an email to the administrator when the file has been downloaded. I
>>have got some code in here that does it, but it will not print in the
>>username or email amddress of the person doing the download - which I am
>>collecting from a form on the previous page. I can get the name and
>>email address to print out normally, just not into the email sending
>>body. I have attached code below:
>
>
> Whooooaa!
> <snip unread code>
>
> Let's say you "print out normally the name and email address" with
>
> echo $name;
> echo $email_address;
>
> Then, in the mail body, just add those variables;
> Where you have (maybe????)
>
> mail($to, $sub, $body, $xtra);
>
> replace with
>
> mail($to, $sub, $body . "\n\n$name $email_address", $xtra);
>
> Voila!


It still isnt working. Is it because I have it inside a function, and
the function blocks the variables from outside the function going into
the function? I made them global, but it still just prints a blank space.

I have

$usrname = $_POST["usrname"];
$usremail = $_POST["usremail"];

which is the name and email that I want to email to the site admin, then
i have this at the very bottom of the script:

echo "Downloads available for: $usrname ($usremail)<br><br>";

which is not in a function, and displays to the screen OK

but this is inside the 'send email' function which doesnt display, even
when I echo it to the screen:

echo "Downloads available for: $usrname ($usremail)<br><br>";

$from_info = "The following file has been downloaded: $download
User Details $usrname, $usremail";


$subject = "File Downloaded: $download";

mail($admin_email, $subject, $from_info . "\n\n$usrname $usremail",
"From: downloads@--.com.au");

Yet the $download seems to pass into the function and display fine!!

Thanks for your help

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация