【发布时间】:2016-07-16 14:34:01
【问题描述】:
我有两页 -
1。索引.html
2. Main.html
我想将数据从 index 发送到 main。我可以这样做:
<form action="Main.html" method="POST">
<input type="text" name="q">
</form>
我想在 Main.html 上显示从 Index.html 发送的数据
我知道两种方法——
1。在表单标签中使用method="GET" 并从 src(link) 中获取数据。
2. 使用 php 等辅助语言。
我不想用第一种方法来做这件事。
请有人给我执行此操作的 php 代码。
如果你能说出任何其他的方法会更有帮助
【问题讨论】:
-
using method="post" in the form tag和get the data from the src(link).你不觉得有争议吗? -
也许你可以通过查询字符串参数检查发送数据的选项。
-
将表单
method更改为GET,然后使用这个:stackoverflow.com/questions/979975/… -
@Rory McCrossan 我不想用那个东西
-
要从 url 获取数据,您需要
method="GET",而不是method="POST"。请在询问代码之前自己尝试一下。使用PHP,可以从全局的$_POST变量中获取服务器端的信息。
标签: javascript php jquery html