Variables that are not checked are not send by default.
Try the code below and see what variables are posted.

<form method=get action="chkbox.html">
<?for($i = 0; $i < 10; $i++):?>
<input type="checkbox" name=p<?=$i?> value=1>p<?=$i?><br>
<?endfor?>
<input type="submit">
</form>

To process variables you may use $HTTP_GET_VARS (or $HTTP_POST_VARS if
you preffer).

adu

PS: If you want the checkboxes to be checked by default you must use
CHECKED, not SELECT :)


> -----Original Message-----
> From: Michael Benbow [mailto:[EMAIL PROTECTED]]
> Sent: 3 iulie 2001 12:08
> To: [EMAIL PROTECTED]
> Subject: Fw: Processing checkboxes in Dynamic tables
> 
> 
> My apologies,
> 
> I was playing with the code and changed something before sending...
> 
> Where it reads <INPUT TYPE=\"CHECKBOX\" SELECT 
> NAME=\"$p[$trade]\" the array should actually read p$trade
> 
> Peace,
> Michael
> 
> 
> ----- Original Message ----- 
> From: Michael Benbow 
> To: [EMAIL PROTECTED] 
> Sent: Tuesday, July 03, 2001 7:02 PM
> Subject: Processing checkboxes in Dynamic tables
> 
> 
> I have a solution to my problem already, but I am looking for 
> a far more economical way of doing this.
> 
> Currently my first page is four seperate tables with about 25 
> or so entries in each.  I have gone through and automatically 
> allocated the name p101 through p125 to the checkboxes for 
> the first table, p201 through p225 to the checkboxes for the 
> second table, etc.
> 
> The user makes selections from each table, but seldomly 
> selects the majority.  They choose which lines they want 
> processed then continue.
> 
> My problem is that with the above solution there are 
> automatically 200 variables being passed from page to page, 
> regardless of how many boxes are checked.  The average amount 
> of boxes may be 10-15, and rarely is it more than 20.
> 
> Currently my code looks like the following...
> 
>     $trade=101;
>   $result = mysql_query("SELECT * FROM $table_name WHERE ......");
>  
>   if ($row = mysql_fetch_array($result)) {
> 
>    do {
>    
>     echo "<tr bgcolor=\"#CBCFFF\">\n";
>     
>     echo "<td valign=\"top\" nowrap><font size=\"-2\">";
>      echo "<INPUT TYPE=\"CHECKBOX\" SELECT 
> NAME=\"$p[$trade]\" OPTION VALUE=\"$row[playerid]\">";
>      echo $trade;
>     echo "</td>\n";
> 
>     ..... 
>     $trade=$trade+1;
>     ..... 
> 
>     } while.....
>   
>     etc.
> 
> Could someone please help me so only the variables which are 
> checked before the submit button is pressed are parsed, eg 
> p102, p107, p117, rather than every input variable which is 
> initialised on the site?
> 
> Thank you heaps in advace,
> Michael.
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to