Hmmm, after trying out the two examples, I came up with these problems.
The first example came up with a result of "A" instead of any of the names. So I changed the
echo "<INPUT TYPE=\"checkbox\" NAME=\"attendees[]\" VALUE=\"".$row["full_name"]."\"> ".$row[full_name]."<br>\n";
to
echo "<INPUT TYPE=\"checkbox\" NAME=\"attendees[$i]\" VALUE=\"".$row["full_name"]."\"> ".$row[full_name]."<br>\n";
Still puts an "A" in the database instead of any of the selected names.
The second example doesn't put in any thing. There seems to be no errors and looking at the source code of the webpage you can see the name array, but none of the selected names get entered.
Is there something else I am missing? I checked and double checked everything and I believe all is correct, here is what the script looks like in full:
case 'add':
if ($REQUEST_METHOD=="POST")
{
echo"<table border=0 cellspacing=0 cellpadding=0 width=\"100%\">\n"
."<tr><th class=\"cell1\"><P class=\"titleHeader\">Manage Minutes</th></tr>\n"
."<tr valign=\"top\"><td>\n";
$minutes = addslashes($minutes);
$location = addslashes($location);
$attendees = addslashes($attendees);
$field_1_title = addslashes($field_1_title);
$field_1_text = addslashes($field_1_text);
$field_2_title = addslashes($field_2_title);
$field_2_text = addslashes($field_2_text);
$field_3_title = addslashes($field_3_title);
$field_3_text = addslashes($field_3_text);
$field_4_title = addslashes($field_4_title);
$field_4_text = addslashes($field_4_text);
$field_5_title = addslashes($field_5_title);
$field_5_text = addslashes($field_5_text);
$conn = db_connect();
for($i=0;$i<count($attendees);$i++)
{
$query = "INSERT INTO minutes (id,minutes,date,location,start_time,end_time,attendees,field_1_title,field_1_text,field_2_title,field_2_text,field_3_title,field_3_text,field_4_title,field_4_text,field_5_title,field_5_text)
VALUES ('$id','$minutes',CONCAT('$year-$month-$day'),'$location','$start_time','$end_time','$attendees[$i]','$field_1_title','$field_1_text','$field_2_title','$field_2_text','$field_3_title','$field_3_text','$field_4_title','$field_4_text','$field_5_title','$field_5_text')";
$result = @mysql_query($query);
}
echo"<P><font color=blue>Minutes Succesfully added!</font>\n";
echo "<P><A href=\"".$PHP_SELF."?pageid=manage_minutes\"><IMG SRC=\"images/back_arrow.gif\" border=0 align=absmiddle> Go back to Manage Minutes</a>\n";
echo"</td></tr></table>\n";
}
else
{
echo"<form action=\"".$PHP_SELF."?pageid=manage_minutes&mode=add\" method=POST>\n"
."<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"NULL\">\n"
."<table border=0 cellspacing=0 cellpadding=0 width=\"100%\">\n"
."<tr><th colspan=2 class=\"cell1\"><P class=\"titleHeader\">Add Minutes</th></tr>\n"
."<tr><td><table border=0 cellspacing=2 cellpadding=2 width=\"100%\">\n"
."<tr><td><DIV id=\"contacttip\"></DIV></td><td><img src=\"images/pixel.gif\" width=10 height=25 border=0></td></tr>\n"
."<tr valign=\"top\"><td>\n"
// Extra non-essential code removed here
."<tr valign=top><td width=100><P CLASS=\"small\">Attendees:</TD><TD><P CLASS=\"small\">\n";
$conn = db_connect();
$query = "select * from members WHERE country='USA'";
$result = @mysql_query($query);
$num_results = mysql_num_rows($result);
$i = 0;
while($row = mysql_fetch_array($result))
{
$bgcolor = ($i++ & 1) ? '#E9EAED' : '#E9EAED';
echo "<INPUT TYPE=\"checkbox\" NAME=\"attendees[$i]\" VALUE=\"".$row["full_name"]."\"> ".$row[full_name]."<br>\n";
}
echo"</td></tr></table>\n";
}
break;
sighs Thanks for any help I can get with this. I've read as much as I can and still can't seem to understand what part I'm doing wrong.