How to fire a PHP function on button click?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BaseballGraphs
    New Member
    • Sep 2010
    • 75

    #1

    How to fire a PHP function on button click?

    Hello,

    I have a PHP function that currently triggers when the page loads.

    I would prefer that this function is only triggered when someone clicks a button.

    How can I accomplish this?

    Thanks for any of your help!
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you cannot directly trigger a PHP function by a user interaction (PHP - server, User - client). what you can do is call a PHP script via AJAX (which itself is triggered by the user interaction) and insert the returning code this way.

    Comment

    Working...