0

Hi Friends,

I have 5 checkboxes. What I want is.....
I want to check 3 checkboxes so other 2 will be unchecked. After clicking the next button a table will appear and checked checkboxes will show in one column and unchecked will be another column.

Can you give any idea how to solve it. example of code will be helpful

Thanks in advance for your help. :)

2
Contributors
1
Reply
8
Views
4 Years
Discussion Span
Last Post by minitauros
0

In PHP? Here's a short example. Page 1:

<form action="page2.php" method="post">
    <input type="checkbox" name="array_name[]" value="true"><br>
    <input type="checkbox" name="array_name[]" value="true">
    <input type="submit">
</form>

Page 2:

<?php
if($_POST['array_name'] && is_array($_POST['array_name'])
{
    // Loop through checked checkboxes.
    $checked_checkboxes = array();

    foreach($_POST['array_name'] as $key => $value)
    {
        $checked_checkboxes[$key];
    }
}
else
{
    // Nothing was checked.
    echo 'No checkboxes were checked...';
    exit();
}

// $checked_checkboxes now contains the names of the keys of your input array called array_name.
// Do whatever you find necessary :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.