checkbox array help
Posted: Mon Dec 18, 2006 1:37 pm
How would I add the value of $check_cat to the array offreq[]?
Code: Select all
<?php
$query = ("SELECT * FROM checkboxes WHERE check_cat='membership_database' ORDER BY id ASC") or die (mysql_error());
$result = mysql_query($query);
mysql_query($query) or die (mysql_error() . 'Cannot Retrieve Information');
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$id = $row['id'];
$text = $row['check_text'];
$check_cat = $row['check_cat']
echo '<tr><td valign="top">';
echo '<input type="checkbox" name="offreq[]" value="';
echo str_replace("company_name", $name, $text) . '">';
echo '</td><td>';
echo str_replace("company_name", $name, $text);
echo '</tr>';
}
?>Code: Select all
$offreq = '<li>' . implode('<li>' , $_POST['offreq']);
$query = "INSERT INTO office_req_final (text) VALUES ('$text)";
mysql_query($query) or die (mysql_error());