I have created a page called functioncalling.php that contains two buttons, Submit and Insert .
(我创建了一个名为functioncalling.php的页面,其中包含两个按钮Submit和Insert 。)
As a beginner in PHP, I want to test which function is executed when a button gets clicked. (作为PHP的初学者,我想测试单击按钮时执行的功能。)
I want the output to come on the same page. (我希望输出出现在同一页面上。)
So I created two functions, one for each button. (因此,我创建了两个功能,每个按钮一个。)
The source code for functioncalling.php is as follows: (functioncalling.php的源代码如下:)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<form action="functioncalling.php">
<input type="text" name="txt" />
<input type="submit" name="insert" value="insert" onclick="insert()" />
<input type="submit" name="select" value="select" onclick="select()" />
</form>
<?php
function select(){
echo "The select function is called.";
}
function insert(){
echo "The insert function is called.";
}
?>
The problem here is that I don't get any output after any of the buttons are clicked.
(这里的问题是单击任何按钮后都没有任何输出。)
Where exactly am I going wrong?
(我到底哪里出问题了?)
ask by Razor translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…