【发布时间】:2020-06-17 14:06:10
【问题描述】:
<form action = "AnotherPage.php" method = "get">
<table id="uniqueID">
<tr>
<td><input id="box1" type="checkbox" name="box1" value = "apple"/><label
for="box1">apples</label></td>
</tr>
</table>
<input type="submit" value="Submit">
</form>
所以当用户提交它时,我将如何在 anotherPage.html 中获取 box1 = apple 信息。谢谢最好没有jquery。所以我希望anotherPage.html 文件执行console.log(box 1 = apple) 并在anotherPage 的html 文件中。 “box 1 = apple”(当然没有硬编码)
编辑。所以我认为最好用php来做。我将如何在 AnotherPage.php 中回显这些数据
【问题讨论】:
-
能否将信息添加到 json 文件中,然后从另一个页面中的 json 中提取该信息?
-
当以 HTML 格式提交表单时,它会通过 GET 或 POST 将数据(输入)发送到其他页面。您应该阅读有关 HTTP 请求的更多信息。
-
用 html javascript 是不可能的。我需要使用php吗?
-
可以使用localStorage或cookie信息保存formaction详情
-
您可以使用 if iseet box1 和 php 并回显该值...
标签: javascript php html