PHP-使用javascript基于PHP语句计算执行函数或退出表单?

PHP-使用javascript基于PHP语句计算执行函数或退出表单?,javascript,php,Javascript,Php,我的页面中有php语句求值,我想执行php函数updatePaidStatus()当用户确认时,或者如果用户取消确认,则退出表单 代码如下: if($Exp_Total>0 && $Rem_Total>0) { //for example I want to do like this using javascript echo '<script> if {Confirmed --> then call this function-->

我的页面中有php语句求值,我想执行php函数updatePaidStatus()当用户确认时,或者如果用户取消确认,则退出表单

代码如下:

if($Exp_Total>0 && $Rem_Total>0)
{
    //for example I want to do like this using javascript

echo '<script> if {Confirmed --> then call this function-->updatePaidStatus();}

else {Cancelled confirmation-->exit the form}
</script>';
}
if($Exp\u Total>0&$Rem\u Total>0)
{
//例如,我想使用javascript这样做
echo“如果{confirm-->则调用此函数-->updatePaidStatus();}”
否则{取消确认-->退出表单}
';
}