i'm posting a form to itself and using the session to store values. the script doesn't insert/update any details to database if the criteria isn't met. that said, i have some check boxes that i can't get to work here is the code.
this goes at the top of the script to set the session and gain the values.
these loops contain the checkboxes retrieving the data back from the databasePHP Code:if(isset($_POST['activities'])) {$_SESSION['activities'] = $_POST['activities']; $activities = $_SESSION['activities']; } else { $activities = ""; }
//Activity checkboxes tag
PHP Code:$acti = mysql_query("select * from activity order by activity");
$html .= "<td style='width:20%'>Activities:</td><td><table style='width:100%' class=login><tr>\n";
$html .= "<td align=\"left\" width=\"25%\" valign=\"top\" >";
for($ok = 1; $ok <= mysql_num_rows($acti);$ok ++)
{
$acy = mysql_fetch_array($acti);
$html .= "<input type=checkbox class=check name=activities[] value=" . $acy[0] . ($activities == $acy[0] ? " checked " : "") . " /> $acy[1]<br>\n";
if($ok===4){break; $html .= "<tr></tr>"; continue;}
}
$html .= "</td>";
$html .= "<td align=\"left\" width=\"25%\" valign=\"top\" >";
for($ok = 5; $ok <= mysql_num_rows($acti);$ok ++)
{
$acy = mysql_fetch_array($acti);
$html .= "<input type=checkbox class=check name=activities[] value=" . $acy[0] . ($activities == $acy[0] ? " checked " : "") . " /> $acy[1]<br>\n";
if($ok===8){break; $html .= "<tr></tr>"; continue;}
}
$html .= "</td>";
$html .= "<td align=\"left\" width=\"25%\" valign=\"top\" >";
for($ok = 9; $ok <= mysql_num_rows($acti);$ok ++)
{
$acy = mysql_fetch_array($acti);
$html .= "<input type=checkbox class=check name=activities[] value=" . $acy[0] . ($activities == $acy[0] ? " checked " : "") . " /> $acy[1]<br>\n";
if($ok===12){break; $html .= "<tr></tr>"; continue;}
}
$html .= "</td>";
$html .= "<td align=\"left\" width=\"25%\" valign=\"top\" >";
for($ok = 13; $ok <= mysql_num_rows($acti);$ok ++)
{
$acy = mysql_fetch_array($acti);
$html .= "<input type=checkbox class=check name=activities[] value=" . $acy[0] . ($activities == $acy[0] ? " checked " : "") . " /> $acy[1]<br>\n";
if($ok===16){break; $html .= "<tr></tr>"; continue;}
}
$html .= "<input type=hidden value=" . mysql_num_rows($acti) . " name=actlimit />\n";
$html .= "</td>";
$html .= "</tr></table></td></tr>\n";



Reply With Quote

Bookmarks