Forum Moderators: coopster

Message Too Old, No Replies

checkboxes into array

         

jackvull

9:47 am on Aug 5, 2008 (gmt 0)

10+ Year Member



I need to get the following into an array but it doesn't seem to be printning anything?


<?
echo "<form action='topClientsEdit.php' method='post'>";
while ($row=mssql_fetch_assoc($result))
{

?>
<tr <?echo $text;?>>
<td style='text-align:left;'><? echo $row['AccountCode'];?> </td>
<td style='text-align:left;'><? echo $row['ParentGroup'];?> </td>
<td style='text-align:left;'><? echo $row['CompanyName'];?> </td>
<td style='text-align:left;'><? echo $row['Description'];?> </td>
<td style='text-align:left;'><? if ($row['TAP'] == 0) {echo "No";} else {echo "Yes";};?> </td>
<td style='text-align:left;'><? echo $row['KAM'];?> </td>
<td>Edit</td>
<td style='text-align:left;'><INPUT TYPE=CHECKBOX id='chk_addgroup[]' name='chk_addgroup[]' value='<?echo $row['AccountCode'];?>'>
<input type='submit' id='addgroup' name='addgroup' value='Add grouping'>
</td>
<td>here</td>
</tr>
<?
}
?>
</form>

Top of page:


if (isset($_POST['addgroup'])) {
for ($i=0; $i<count($_post['chk_addgroup']); $i++){
$chk_addgroup_req = addslashes($_post['chk_addgroup'][$i]);
echo $chk_addgroup_req;
//do this
//do that
}//end loop
echo "HERE";
}

mrscruff

11:36 am on Aug 5, 2008 (gmt 0)

10+ Year Member



name='chk_addgroup[]' => name='chk_addgroup'

jackvull

12:01 pm on Aug 5, 2008 (gmt 0)

10+ Year Member



it works with the GET method for some reaosn

coopster

4:49 pm on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



$_post should be $_POST
Variable names [php.net] are case-sensitive.