#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    5
    Rep Power
    0

    CHeckbox with Table


    Hi
    I have table with 6 columns where one column is checkbox i need to display the respective columns of the selected checkbox alone in the next page
    Can anyone Please help me
    Thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,600
    Rep Power
    595
    Since you didn't post any code I have to be just as vague as you in proposing a solution. Use 'isset' in an 'if' block on the checkbox array or name.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    5
    Rep Power
    0

    Checkbox with table


    the content is here

    <?php for($i=0;$i<$sen;$i++){ ?>
    <tr valign="top" bgcolor="#ffffff">
    <td width="5%" align="center"><?php echo $sno[$i]; ?></td>
    <td width="8%" align="center"><?php echo $icode[$i]; ?></td>
    <td width="50%" align="center"><?php echo $material[$i]; ?></td>
    <td width="5%" align="center"><?php echo $quant[$i]; ?></td>
    <td width="5%" align="center"><?php echo $unit[$i]; ?></td>
    <td width="8%" align="center"><?php echo $make[$i]; ?></td>
    <td width="10%" align="center"><?php echo $esrate[$i]; ?></td>
    </tr>
    <?php } ?>


    i have to select this at run time and need to display only checked items in the next page
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    5
    Rep Power
    0
    <td width="4%" align="center"><input type="checkbox" name="chk[]" /></td>

    Sorry i missed this line
    Thanks for ur reply
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,600
    Rep Power
    595
    I don't think that will do what you expect. The only values that will be set in the 'chk' array are those whose corresponding boxes are checked. I am guessing you want to associate which boxes are checked with the row of the table. Unchecked boxes will not show up in the array. In other words, if you check box number 3, there will be only 1 element in chk and it will have an index of 0. I suggest you either use an associative or indexed array and explicitly specify it in your form. Something like this.
    PHP Code:
    echo "<td width=\"4%\" align=\"center\"><input type=\"checkbox\" name=\"chk[".$rowname."]\" /></td>"
    Then you simply use a 'foreach' loop and a switch block. If you use an explicitly indexed array it is a bit more complicated for only 6 items.
    Last edited by gw1500se; April 10th, 2013 at 08:40 AM.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo