我有一个使用jquery、mysql和php的页面。在页面中,我有一个输入,例如下面的
<input type="text" name="numberid" id="textbox1" value="12345" />
我试图将这个信息文本框1与一个php语句结合起来,该语句从mysql数据库中提取,创建一个重定向到网站的按钮。我已经完成了url并提取了$item,但不知道如何在之后将textbox1变量值附加到url的末尾?Id=
<span style="margin-left:10px;"><a href="http://www.example.com/<?php echo $item?>?Id=textbox1"><input type="button" class="btn btn-info edit" value="Share" style="width:100px; height:50px" id="<?php echo $id; ?>"name="<?php echo $parent; ?>"></a></span>
使用类似的东西,也许是类
<a class="pressthis" href="#" data-mhtml="put your html reference here" >
然后使用类似以下的功能
$(".pressthis").click(function() {
var myhtml = $(this).data('mhtml');
myhtml = myhtml + "&yourtextbox=" + $textbox1.val();
window.location = myhtml
});
这将允许您使用相同的函数处理任意数量的html链接。显然,如果您想在html的末尾添加一些id,比如文本框的内容,那么只需将文本框的属性添加到myhtml字符串中即可
myhtml = myhtml + "&yourtextbox=" + $textbox1.val();