instead of giving them unique names, put them all into
a single array:

<INPUT ... NAME="p[1]">
<INPUT ... NAME="p[2]">

or, to automatically number them:
<INPUT ... NAME="p[]">
<INPUT ... NAME="p[]">

this way, you can deal only with $p[...]
instead of $p101, $p202, $p203


> -----Original Message-----
> From: Michael Benbow [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 03, 2001 5:02 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] 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