来自html的Php参数化函数调用[重复]

来自html的Php参数化函数调用[重复]

问题描述:

This question already has an answer here:

I have a problem with calling a phpfunction from a onclick() event.

<button onclick=delete($a) >click here</button>


<?php 
Function delete($a)
{
----statements----
}

?>

Please help me solving this functiom call

</div>

You cannot call a php function from a javascript onclick event that way. php is strictly server side, the only way is to make an ajax call to a script that will run the function and return the result. Once the page is served, all trace of php disappears, there is no reference or anything of php left in the client side.