javascript - How to get the rows value in php as all rows name is same? -


please find below code add new rows delete row button. using script can enable 5 rows after "add more" button automatically disable. problem is, if click on submit button php page should print rows values. not able print rows values rows name same (input_box_one[] , input_box_two[] ). hence not able rows.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">         <head>                 <meta http-equiv="content-type" content="text/html; charset=utf-8" />                  <script type="text/javascript" src="./jquery-1.7.min.js"></script>                 <script type="text/javascript">                         $(document).ready(function(){                                  $('.del').live('click',function(){                                         $(this).parent().parent().remove();                                 });                                  $('.add').live('click',function(){                                         var = 1;                                          var appendtxt = "<tr><td>pront id:</td><td><input type='text' name='input_box_one[]' /></td><td>pronto title:</td> <td><input type='text' name='input_box_two[]' /></td> <td><input type='button' class='del' value='delete' /></td></tr>";                                         $("tr:last").before(appendtxt);  var inputs = document.getelementsbytagname('input').length; if(inputs == 17){ document.getelementbyid("countbutton").disabled = true; } $i++                                  });                         });                 </script>          </head>      <body>     <form name="form1" method="post" action="<?php echo $_server['php_self']; ?>">                  <table id="options-table">                         <tr>                                 <td>pront id:</td><td><input type="text"   name="input_box_one[]" /></td>                                 <td>pronto title:</td><td><input type="text"     name="input_box_two[]" /></td>                                 <td><input type="button" class='del' value='delete' /></td>                                 <input type="hidden" name="count" value="<?php $i; ?>">                         </tr>  <?php         echo "<tr><td><input id=\"countbutton\" type=\"button\" class=\"add\" value=\"add more\"/></td><td><input type=\"submit\" name=\"submit\" value=\"submit\"></td></tr>"; ?>                   </table>                 </form>     </body> </html> 

could please on this.

thanks in advance.

editing question:

hi,

in script need enter pronto id 12 character. if it's less/more 12 should echo message enter 12 character. code should add line? please me.

var appendtxt = "<tr><td>pront id:</td><td><input type='text' name='input_box_one[]' /></td><td>pronto title:</td> <td><input type='text' name='input_box_two[]' /></td> <td><input type='button' class='del' value='delete' /></td></tr>"; 

print $_post varaible on php page like

<?php print_r($_post); ?> 

than idea of posted inputs.afterword have use foreach method.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -