使用Jquery和PHP发布和检索多个文本框值

使用Jquery和PHP发布和检索多个文本框值,php,jquery,post,http-post,Php,Jquery,Post,Http Post,我有可以创建多个文本框的Jquery代码。现在,我想提交文本框的值,以便在下一页使用PHP获取它们。我想以与()相同的方式提交文本框 在第二页,我可以使用POST方法获取值。在这种情况下,我如何发布多个文本值,以及如何使用php在下一页检索它们??请帮助我,因为我是一只新蜜蜂 代码: <head> <script type="text/javascript"> $(document).ready(function(){ var counter = 2; $(

我有可以创建多个文本框的Jquery代码。现在,我想提交文本框的值,以便在下一页使用PHP获取它们。我想以与()相同的方式提交文本框
在第二页,我可以使用POST方法获取值。在这种情况下,我如何发布多个文本值,以及如何使用php在下一页检索它们??请帮助我,因为我是一只新蜜蜂

代码:

<head>
  <script type="text/javascript">

  $(document).ready(function(){

var counter = 2;

$("#addButton").click(function () {

if(counter>10){
        alert("Only 10 textboxes allow");
        return false;
}   

var newTextBoxDiv = $(document.createElement('div'))
     .attr("id", 'TextBoxDiv' + counter);

newTextBoxDiv.after().html('<label>Textbox #'+ counter + ' : </label>' +
      '<input type="text" name="textbox' + counter + 
      '" id="textbox' + counter + '" value="" >');

newTextBoxDiv.appendTo("#TextBoxesGroup");


counter++;
 });

    $("#removeButton").click(function () {
if(counter==1){
      alert("No more textbox to remove");
      return false;
   }   
  counter--;          $("#TextBoxDiv" + counter).remove(); });
       $("#getButtonValue").click(function ()
  {
   var msg = '';
  for(i=1; i<counter; i++){
  msg += "\n Textbox #" + i + " : " + $('#textbox' + i).val();
  }

  alert(msg);
    });
    });
     </script>
    </head><body>

 <div id='TextBoxesGroup'>
<div id="TextBoxDiv1">
      <label>Textbox #1 : </label><input type='textbox' id='textbox1' >
</div>
  </div>
  <input type='button' value='Add Button' id='addButton'>
  <input type='button' value='Remove Button' id='removeButton'>
  <input type='button' value='Get TextBox Value' id='getButtonValue'> 
  </body>

$(文档).ready(函数(){
var计数器=2;
$(“#添加按钮”)。单击(函数(){
如果(计数器>10){
警报(“仅允许10个文本框”);
返回false;
}   
var newTextBoxDiv=$(document.createElement('div'))
.attr(“id”,“TextBoxDiv”+计数器);
newTextBoxDiv.after().html('Textbox#'+计数器+':'+
'');
newTextBoxDiv.appendTo(“#textboxsgroup”);
计数器++;
});
$(“#移除按钮”)。单击(函数(){
如果(计数器==1){
警报(“不再需要删除文本框”);
返回false;
}   
计数器--;$(“#TextBoxDiv”+计数器).remove();});
$(“#getButtonValue”)。单击(函数()
{
var msg='';

对于(i=1;i尝试将文本框命名为数组
e、 g.输入type='textbox'name='textbox[]'id='textbox1'
并在PHP页面上以数组的形式访问它
$arrayRequest=$_请求['textbox']