Need help with php functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Need help with php functions

I want a function to be called when someone click a button but because html follows client side and php server side scripting so it is not possible to use it directly is there any other way to do it except using js ajax method . If no please elaborately define ajax method as I don't want to use something I don't understand.

17th Apr 2019, 7:27 AM
Gursharan Singh
Gursharan Singh - avatar
2 Answers
+ 4
You could use WebSockets (which I would not recommend because it’s quite advanced) or AJAX. Google up AJAX, and you should find loads of helpful tutorials online.
17th Apr 2019, 8:07 AM
Rowsej
Rowsej - avatar
+ 1
You cannot call server side functions from client side without the use of JavaScript or Jquery and Ajax. Because php functions execute in server side. https://stackoverflow.com/questions/5967322/calling-a-php-function-from-an-html-form-in-the-same-file
17th Apr 2019, 7:54 AM
sbkrish
sbkrish - avatar