PHP function from an HTML href

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danjpalmer
Forum Newbie
Posts: 5
Joined: Fri Dec 04, 2009 6:45 am

PHP function from an HTML href

Post 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
dejvos
Forum Contributor
Posts: 122
Joined: Tue Mar 10, 2009 8:40 am

Re: PHP function from an HTML href

Post 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.
danjpalmer
Forum Newbie
Posts: 5
Joined: Fri Dec 04, 2009 6:45 am

Re: PHP function from an HTML href

Post by danjpalmer »

Hi,

Thanks for the information. I will give this a go
danjpalmer
Forum Newbie
Posts: 5
Joined: Fri Dec 04, 2009 6:45 am

Re: PHP function from an HTML href

Post by danjpalmer »

does the same apply from within an onSubmit within a form?
danjpalmer
Forum Newbie
Posts: 5
Joined: Fri Dec 04, 2009 6:45 am

Re: PHP function from an HTML href

Post 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.
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: PHP function from an HTML href

Post by timWebUK »

That would be using:

Code: Select all

<a href="mailto:email@example.com">Email Us</a>
danjpalmer
Forum Newbie
Posts: 5
Joined: Fri Dec 04, 2009 6:45 am

Re: PHP function from an HTML href

Post by danjpalmer »

I get that bit, I meant the passing of data into the email body that has just been opened?
Post Reply