Broken link - Button

Phoca Download - download manager
cohenu
Phoca Member
Phoca Member
Posts: 28
Joined: 30 Jan 2010, 14:22

Broken link - Button

Post by cohenu »

I am trying to add a button that will send me an email when someone click on it.
I saw that I need to send this variable- $valueDoc->title
someone can help me to use mail function to send an email with this variable?

Thanks a lot :wink:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49138
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Broken link - Button

Post by Jan »

Hi, try to see the Joomla! framework guides, there should be described mail function.

Jan
If you find Phoca extensions useful, please support the project
cohenu
Phoca Member
Phoca Member
Posts: 28
Joined: 30 Jan 2010, 14:22

Re: Broken link - Button

Post by cohenu »

10x Jan I will :|
cohenu
Phoca Member
Phoca Member
Posts: 28
Joined: 30 Jan 2010, 14:22

Re: Broken link - Button

Post by cohenu »

Where I am wrong with this?
every time I am refresh the page it send an email how can I make it send just on click?

Code: Select all

$from = 'broken@domain.com';
$fromname = 'BrokenLink@domain.com';
$subject = 'BrokenLink';
$body =  $valueDoc->title;
$recipient[] = 'myemail@gmail.com';
JUtility::sendMail($from, $fromname, $recipient, $subject, $body);
echo '<a href="#" onclick='sendMail()'>Broken Link</a>';
I put it in the end of default.php at file view
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49138
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Broken link - Button

Post by Jan »

Hi, sorry I don't understand. You have some javascript which call some javascript function, but the code is PHP :idea:

Jan
If you find Phoca extensions useful, please support the project
cohenu
Phoca Member
Phoca Member
Posts: 28
Joined: 30 Jan 2010, 14:22

Re: Broken link - Button

Post by cohenu »

Yeah as you can see I not learning anything, all I do is guessing :lol:

so I have a php code that can send email and it work.
I can make a button that call this page or I can put that code in the file view.
if I put it in different page I don't know how to send this variable - $valueDoc->title to mail.php
if I put the code in the same page every refresh it send and email so I need to put in inside a function and trigger it with onclick but I don't manage to do it.

I try a lot of things and search the internet but I don't find a way to make it stop sending email every refresh, if I am putting the mail function inside function I don't manage to call it with onclick what I am doing wrong?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49138
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Broken link - Button

Post by Jan »

The mail function can be called only by PHP, so you need to send some form data to work with php again and send the email.
If you find Phoca extensions useful, please support the project
Post Reply