开发者

How to get value from checked checkbox, which are in a table

I have a form:

<form action='send.php' method ='post'>
        SMS: <input type='checkbox' name = 'sms'>
        E-mail: <input type='checkbox' name = 'email' id='mailcheck'><br>
        <TEXTAREA NAME='message' WRAP='virtual' COLS='40' ROWS='3'>
        </TEXTAREA><br>
        <input type ='submit' name ='Send' size = '10' value = 'send'>
        </form>

I have a table which construct from DB:

$table = "<table border=1 width=100% align=center>\n";
        $table .= "<tr>\n";
        $i = 1;
        while ($i < mysql_num_fields($queryResult)) {
            $meta = mysql_fetch_field($queryResult, $i);
            $i++;
            $table .= "<td>".$meta->name."</td>\n";
        }
        $table .= "<td> Выбрать все: <input type='checkbox' name='maincheck' value='main' id='chkSelectAll'</td>\n";
        $table .= "</tr>\n";
        $i = 1;
        while ($row = mysql_fetch_assoc($queryResult)){     
            $table .= "<tr>\n";
            $table .= "<td>".$row['name']."</td>\n";
            $table .= "<td>".$row['post']."</td>\n";    
            $table .= "<td>".$row['section']."</td>\n";  
 开发者_Go百科           $table .= "<td>".$row['company']."</td>\n";  
            $table .= "<td>".$row['phone_number']."</td>\n";  
            $table .= "<td>".$row['email']."</td>\n";  
            $table .= "<td>".$row['status']."</td>\n";  
            $table .= "<td>".$row['lock_time']."</td>\n";  
            $table .= "<td>".$row['reason_for_blocking']."</td>\n";  
            $table .= "<td><input type='checkbox' class=".check."  name='cbname3[]' id='chkItems' value=".$row['id']." /></td>";
            $table .= "</tr>\n";
            $i++;
        }
        $table .= "</table>\n";
        echo $table;

I want to take value of checked checkboxes from table to send.php.

I cant take this throw $_POST, because it's different forms!


I cant take this throw $_POST, because it's different forms!

With your code as written in the question, the checkboxes are not inside any form and you have only one form.

Put the table inside that form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜