【发布时间】:2014-04-25 12:50:00
【问题描述】:
我有一个表单,我需要它首先使用 URL 为几个字段插入数据。我在下面附上了我的表格样本。我们使用 PHP 将其发布到 mySQL 数据库中。我不介意它是如何进入那里的。但是我已经看到了使用 example.com/form.php?add_1=10 The Street 的示例,这对我来说是最好的方式。
谢谢,
<form role="form" method="post" action="<?php $_SERVER['PHP_SELF'] ?>" name="epicform">
<input type="text" class="form-control" id="lastname" name="surname" required style="
height: 35px;
">
<input type="text" class="form-control" id="add_1" name="add1" placeholder="Address Line 1" required style="
height: 35px;
">
<input type="text" class="form-control" id="add_2" name="add2" placeholder="Address Line 2" required style="
height: 35px;
">
<input type="text" class="form-control" id="add_3" name="add3" placeholder="Address Line 3" required style="
height: 35px;
">
<input type="text" class="form-control" id="postcode" name="postcode" placeholder="Postcode" required style="
height: 35px;
">
<input type="text" class="form-control" id="phone_number" name="phoneNum" placeholder="Phone Number" required style="
height: 35px;
">
</form>
我已经在这里尝试了一个 javascript 解决方案,但我似乎无法让它做任何事情。
【问题讨论】:
-
询问代码的问题应该表明对正在解决的问题的基本理解。包括尝试的解决方案、它们为什么不起作用以及预期的结果。另见:Stack Overflow question checklist.
-
我已经尝试过stackoverflow.com/questions/14070105/…,但我似乎无法让它做任何事情!
-
@JohnConde 关闭选项发生了什么?那是有史以来最好的一次。 (我看到你已经存档了);-) 所以应该把它放回去。+1(我想我会自己保留一份副本)。
-
我也喜欢它,但 SO 觉得有更好的方法来做到这一点。我认为这些总结了这个问题很好地。因此,我仍然使用它。
-
是的,它确实很好地总结了它。 @JohnConde 我正在保存它以备将来使用。