我需要创建一个html页面,该页面将接受来自一个网页的输入,然后在单独的HTML页面上打印出用户结果。到目前为止,我有这个。当我去检查我的action_page.php文件时,没有任何内容被写入其中。无论如何,我可以将我的输入直接打印在第二个HTML页面上并不断更新?外部应用程序是否有任何方法可以控制或更改第二个网页上显示的值?
所以我想对我想要做的更清楚的描述是在一个页面上接受输入A,B,C然后在另一个具有之前的A,B,C值的html页面上我想要更新使用新用户提交的值的值。第二个网页也需要是静态的,因为第一个html页面是website.com/UserInput,第二个html页面是website.com/PrintedUserInput。我希望有所帮助。感谢
<html>
<body>
<form action="action_page.php">
Time:
<br>
<input type="number" name="Time" value="">
<br>
Temperature:
<br>
<input type="number" name="Temperature" value="">
<br>
Instant Brew:
<br>
<input type="number" name="InstantBrew" value="">
<br>
<br>
<input type="submit" value="Submit">
</form>
<p>If you click "Submit", the form-data will be sent to a page called "action_page.php".</p>
</body>
</html>
答案 0 :(得分:1)
你需要做的就是采用&#34;方法&#34;属性如下:
<form action="action_page.php" method="post">
您绝对需要服务器端语言才能打印出来。由于您将页面与PHP扩展一起使用,我猜测您正在使用PHP。那么你可以在其他页面中以这种方式调用它们:
<html>
<body>
Time: <?= $_POST['Time'] ?>
<br>
Temperature: <?= $_POST['Temperature'] ?>
等,你在POST大括号之间放置的名字是&#34; name&#34;您输入的属性。请注意,name属性区分大小写
希望它有所帮助!