mercredi 17 juin 2015

php error in getting multidimensional array through checkbox and textboxes of same row or multiple rows

i want to fetch multiple textbox values corresponding to the checkbox selected... we can select one or multiple checkboxes at a time and on button click the output i need is like this: suppose my array is like this: array1('first','second','third'); array2('a','b','c','d','e','f','g','h','i') . and output i need is:-

first,a,b,c
second,d,e,f
third,g,h,i

plz suggest me !! here is my demo code:

<?php
if(isset($_REQUEST["button7"]))
{
    if(isset($_POST['check1']))
    { 
    if (is_array($_POST['check1'])) 
        {
                foreach($_POST['check1'] as $key=> $value)
                {
                    echo "<br>checkbox value is $key :". $value;
                        if (is_array($_POST['hindi'])) 
                        {
                              foreach($_POST['hindi'] as $value)
                                {
                                    echo "<br>".$value;
                                }

                        } 
                }
        }
    }
}
?>
<form name="files" action="demp.php"  method="post">
<table width="300" border="1" >
 <tr>
         <th>check value</th>
         <th>English Name</th>
         <th>Hindi Name</th>
  <tr>
<?php
for($i=0;$i<10;$i++)
{?>
<td><input name="check1[]" class="checkbox2" type="checkbox" id="check1" value="<?php echo "checkboxvalue = ".$i;?>" /></td>
<td><input type="text" value="" name="hindi[]" id="txt1"></td>
<td><input type="text" value="" name="hindi[]" id="txt2"></td></tr>
<?php 
}

?>
</table>
<input type="submit" name="button7" value="edit_pdf">




Aucun commentaire:

Enregistrer un commentaire