what am I doing wrong?

From: Date: Fri, 02 May 2003 19:17:15 +0000
Subject: what am I doing wrong?
Groups: php.general 
Request: Send a blank email to php-general+get-146179@lists.php.net to get a copy of this message
Ok, so I have been trying to create a dynamic database driven form. In the form, there is a list of checkboxes that come from a table in the database. I can create the list just fine, but when I want to use the data in the checkboxes, I keep screwing up. There are a few things that need to be done with the data, but right now, so I can figure out what the heck I'm doing wrong, all I want to do is submit the form and display the values. I keep getting this error: Warning: Invalid argument supplied for foreach() in /usr/local/packages/apache-1.3.27/htdocs/amccomb/prodev/customer_form.php on line 563 Why am I so confused about this? Anyway, here is a snippet of code that is giving me errors. (the form itself is soooo long, I don't want to post everything). Join these list servs: <?$query = "SELECT * FROM list_serv_t WHERE retired_flag is NULL OR retired_flag = 0 ORDER BY list_serv_name"; $search_results = mysql_query($query) or die("Select Failed!"); ?> <?while ($search_result = mysql_fetch_array($search_results)) {?> <INPUT TYPE="checkbox" NAME="list_serv[<? echo $search_result['list_serv_cd']; ?>]" SIZE="20" MAXLENGTH="50" VALUE="1"><? echo $search_result['list_serv_name'] ?> <BR> <? } foreach( $_POST['list_serv'] as $list_serv_cd => $quantity) { $quantity *= 1; // make it numeric if($quantity) { // if one exists echo $list_serv_cd; } } ?>

« previous php.general (#146179) next »