Php 如何将主题绑定到链接并注入表单
这就是我想要实现的目标: 有主题的链接。单击链接时,您将被引导到已填写链接主题的表单Php 如何将主题绑定到链接并注入表单,php,jquery,Php,Jquery,这就是我想要实现的目标: 有主题的链接。单击链接时,您将被引导到已填写链接主题的表单 <!-- here should the subject in, lets say: reference 1 --> <a href="form.html">Link with subject</a> 表格: <form action=""> <input name="subject" type="text" id="subject" />
<!-- here should the subject in, lets say: reference 1 -->
<a href="form.html">Link with subject</a>
表格:
<form action="">
<input name="subject" type="text" id="subject" /> <!-- the subject is already filled in from the link -->
<textarea name="message" id="" cols="30" rows="10"></textarea>
<input type="submit" value=Send" />
</form>
由于标记了php,因此可以在链接中使用查询字符串:
<!-- here subject is in query string -->
<a href="form.php?subject=Link+with+subject">Link with subject</a>
既然它被标记为php,为什么不使用php呢
<a href="form.html?subject=<?= urlencode('Your subject here') ?>">Link</a>
并以以下形式:
<form action="">
<input name="subject" type="text" id="subject" value="<?= urldecode($_GET['subject']) ?>" />
</form>
这太棒了!关于这一点,还有一个问题:在值中有
<form action="">
<input name="subject" type="text" id="subject" value="<?= urldecode($_GET['subject']) ?>" />
</form>