1 回答
TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超5個(gè)贊
已在此處回答:- 單擊按鈕運(yùn)行 php 函數(shù)
我這邊的另一個(gè)例子:-
如何在單擊按鈕時(shí)調(diào)用 PHP 函數(shù)?
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h4>
How to call PHP function
on the click of a Button ?
</h4>
<?php
if(array_key_exists('button1', $_POST)) {
button1();
}
else if(array_key_exists('button2', $_POST)) {
button2();
}
function button1() {
echo "This is Button1 that is selected";
}
function button2() {
echo "This is Button2 that is selected";
}
?>
<form method="post">
<input type="submit" name="button1"
class="button" value="Button1" />
<input type="submit" name="button2"
class="button" value="Button2" />
</form>
來(lái)源:- https://www.geeksforgeeks.org/how-to-call-php-function-on-the-click-of-a-button/
- 1 回答
- 0 關(guān)注
- 122 瀏覽
添加回答
舉報(bào)
