Trigger PHP function by clicking HTML link

后端 未结 5 1345
耶瑟儿~
耶瑟儿~ 2020-12-21 03:04

Is it possible to trigger a PHP function by just clicking a link? Or should I stick with the form submit method? If clicking the link will work, where should the link refer

5条回答
  •  心在旅途
    2020-12-21 03:35

    To trigger a function on link click with php the only way I know would be to append a param in the url of the link and then listen for that

    Add my username to the list
    

    Then check for link

    if (isset($_GET['function'])){
          runFunction();
    }
    

    This is because php is a server side technology if you want to fire something without refreshing the page you would need to look at something like javascript

提交回复
热议问题