我正在尝试在同一页面的文本框中发布php的结果,但不知道如何做。代码如下在html中输出的PHP
<form action = "<?php $_PHP_SELF ?>" method = "GET" >
Input1: <input type = "text" name = "input1" />
Input2: <input type = "text" name = "input2" />
Result: <input type = "text" name = "result" />
<input type = "submit" />
</form>
完整代码:
<?php
$input1 = $_GET["input1"];
$input2 = $_GET["input2"];
$result = $input1 + $input2;
echo "$result";
?>
<html>
<body>
<form action = "<?php $_PHP_SELF ?>" method = "GET" >
Input1: <input type = "text" name = "input1" />
Input2: <input type = "text" name = "input2" />
Result: <input type = "text" name = "result" />
<input type = "submit" />
</form>
</body>
</html>
我想表明的结果的文本框$结果。 谢谢。
的哪里是'$ result'设置? – mulquin
php有什么结果? – ThisGuyHasTwoThumbs
Complete Code: <?php \t $ input1 = $ _GET [“input1”]; \t $ input2 = $ _GET [“input2”]; \t \t $ result = $ input1 + $ input2; \t \t echo“$ result”; ? \t >
\t \t <形式行动= “?