Page 1 of 1

PHP function from an HTML href

Posted: Fri Dec 04, 2009 6:51 am
by danjpalmer
Hi,

I want to call a PHP function from an HTML href, is this possible?

Basically the page I have grabs data from the URL string and displays it in a table. The function I have created sends this data in an email. I have a send results link underneath the table that I need to run the email function I have. Is this possible?

thanks

Re: PHP function from an HTML href

Posted: Fri Dec 04, 2009 7:16 am
by dejvos
This function must be in some script callable through URL.

Code: Select all

 <a href="http://smth.com/email.php?to=rcpt@domain.com">Send mail</a> 
There is no possibility to call directly the function. Only script containing the function.

Re: PHP function from an HTML href

Posted: Fri Dec 04, 2009 7:58 am
by danjpalmer
Hi,

Thanks for the information. I will give this a go

Re: PHP function from an HTML href

Posted: Fri Dec 04, 2009 8:13 am
by danjpalmer
does the same apply from within an onSubmit within a form?

Re: PHP function from an HTML href

Posted: Fri Dec 04, 2009 8:45 am
by danjpalmer
ok new angle....

Can I get PHP to launch the a new email message in the default email client? So for example I click a button and it passes data to a new email in Outlook?

thanks again for your help.

Re: PHP function from an HTML href

Posted: Fri Dec 04, 2009 9:41 am
by timWebUK
That would be using:

Code: Select all

<a href="mailto:email@example.com">Email Us</a>

Re: PHP function from an HTML href

Posted: Sat Dec 05, 2009 6:39 am
by danjpalmer
I get that bit, I meant the passing of data into the email body that has just been opened?