Asmodean - using comma is another way of using echo... Wee - try this instead - you're putting two loops together when you don't need to
for($count=1; $count<=$rows; $count++) { $query_data = mysql_fetch_array($result); $price = $query_data["price_lq"]; $RowColor = useColor(); // current echo statements here } or $count=1; while($query_data = mysql_fetch_array($result)) { $price = $query_data["price_lq"]; $RowColor = useColor(); // current echo statements here } $count++; -----Original Message----- From: Asmodean [mailto:[EMAIL PROTECTED]] Sent: Friday, July 19, 2002 10:48 AM To: PHP General Subject: Re: [PHP] Please Help with LOOP!! Hello Wee, Friday, July 19, 2002, 2:36:40 AM, you wrote: WK> Hi all... WK> I'm a complete beginner in programming. Just started a few months ago. WK> So, I'm sorry if this is a stupid question to ask. But I'm at a dead end here and do not know where else to go. WK> I'm trying to automate a checkbox name to have the name "choice1" to have incremental effect on the number such as the following: WK> <input type="checkbox" name="choice1" value="x"> WK> <input type="checkbox" name="choice2" value="x"> WK> <input type="checkbox" name="choice3" value="x"> WK> ... WK> And I used the following script (please don't laugh) :) WK> Maximise this email to full screen so that you can see the script better. WK> for($count=1; $count<=$rows; $count++) { WK> while($query_data = mysql_fetch_array($result)) { WK> $price = $query_data["price_lq"]; WK> $RowColor = useColor(); WK> echo "<TR BGCOLOR=\"$RowColor\">\n"; WK> echo "<TD width=\"10%\" valign=\"top\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">",$query_data["prod_brand"],"<BR></FONT</TD>"; WK> echo "<TD width=\"60%\" valign=\"top\"><font size=\"2\" face=\"Arial, Helvetica, sans-serif\">",$query_data["prod_desc"],"<BR></FONT></TD>"; WK> echo "<TD width=\"15%\" valign=\"top\<font size=\"2\" face=\"Arial, Helvetica, sans-serif\">","$",$price,"<BR></FONT></TD>"; WK> echo "<TD width=\"15%\" valign=\"top\"><input type=\"checkbox\" name=\"choice",$count,"\" value=\"", $query_data["prod_id"],"\"></TD>\n</TR>"; WK> } WK> } WK> The result was irritating... it came up with the same name, which is "choice1" all the way like: WK> <input type="checkbox" name="choice1" value="x"> WK> <input type="checkbox" name="choice1" value="x"> WK> <input type="checkbox" name="choice1" value="x"> WK> ... WK> Am I doing it the wrong way? If so, how should I do it? WK> Please pleas help... thanks WK> Yours, WK> Wee Keat WK> ------------------------------------------------------------ WK> "Good timber does not grow with ease; the stronger the wind, the stronger the trees." echo "<TD width=\"15%\" valign=\"top\"><input type=\"checkbox\" name=\"choice",$count,"\" value=\"", $query_data["prod_id"],"\"></TD>\n</TR>"; Your problem is with this line. Look closely at the following part: name=\"choice",$count,"\" You should do this: name=\"choice" . $count . "\" ... and it will generate names like 'choice1', 'choice2', and so on. -- Best regards, Asmodean mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php