我只是 jQuery 的新手,有人可以帮助我吗?
我想创建一个像this one这样的发票系统
我需要做的就是添加一个提交按钮,该按钮将起到这样的作用
.查找由某个唯一 ID 标识的文本区域的所有输入
然后将该值发布到 php MySQl 每行将包含独特的数据。
最佳答案
无论如何,您的问题不明确,这将为您提供所有文本框的值数组
$(document).ready(function(){
$('#somebuttonid').click(function(){
var tbarray = new Array();
$('.yourtextboxclass').each(function(){
tbarray.push($(this).val()); //You will have a array tbarray with all the values of textboxes
}):
$('#somehiddenelementid').val(tbarray);
$('#somehiddenelementidcontainingform').submit(); //Make sure your action is set,you can access like $_post['$somehiddenelmentname'];
});
});
<!--html side-->
<form id="somehiddenelementidcontainingform" action="youraction" method="post">
<input type="hidden" name="somehiddenelmentname[]" id="somehiddenelementid" />
</form>
关于php - 查找所有文本框值并发布到 PHP MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8396576/