Generate Report
| From: | Jeff Broomall | Date: | Wed, 22 Feb 2006 04:06:47 +0000 |
| Subject: | Generate Report | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41310@lists.php.net to get a copy of this message | ||
I thank those who promptly responded to my first inquiry on the list.
This second request is, I assume, a tad more challanging.
I need a "Generate Report" function that'll allow the user to select one or more "groups" and what columns he would like to view.
For instance,
<fieldset><legend>Generate Report</legend>
<form action="generate_report.php" method="post">
<CENTER>
<TABLE BORDER="1" cellpadding="5" cellspacing="5">
<TR>
<TD rowspan="2" valign="bottom"><strong>Select Group(s)</strong></TD>
<TD colspan="2"><strong>Select Columns</strong></TD>
</TR>
<TR>
<TD><strong>Category One</strong></TD>
<TD><strong>Category Two</strong></TD>
</TR>
<TR>
<TD align="left" valign="top">
<input name="sel_group[]" type="checkbox" value="1">Group A<BR>
<input name="sel_group[]" type="checkbox" value="2">Group B<BR>
<input name="sel_group[]" type="checkbox" value="3">Group C<BR>
<input name="sel_group[]" type="checkbox" value="4">Group D<BR>
</TD>
<TD align="left">
<input name="sel_cols[]" type="checkbox" value="Column A">Column A<BR>
<input name="sel_cols[]" type="checkbox" value="Column B">Column B<BR>
<input name="sel_cols[]" type="checkbox" value="Column C">Column C<BR>
<input name="sel_cols[]" type="checkbox" value="Column D">Column D<BR>
<input name="sel_cols[]" type="checkbox" value="Column E">Column E<BR>
<input name="sel_cols[]" type="checkbox" value="Column F">Column F<BR>
</TD>
<TD align="left">
<input name="sel_cols[]" type="checkbox" value="Column G">Column G<BR>
<input name="sel_cols[]" type="checkbox" value="Column H">Column H<BR>
<input name="sel_cols[]" type="checkbox" value="Column I">Column I<BR>
<input name="sel_cols[]" type="checkbox" value="Column J">Column J<BR>
<input name="sel_cols[]" type="checkbox" value="Column K">Column K<BR>
<input name="sel_cols[]" type="checkbox" value="Column L">Column L<BR>
</TD>
</TR>
</TABLE>
</CENTER>
<input name="submit" type="button" value="Generate">
</form>
</fieldset>
Let's say the user wants to view Group A and Group B AND view content from the Coulmn A, Column B, Column D, and Column K.
So a checkmark would be placed within each box and the "Generate Report" button would be "hit" to generate a report with titles situated horizontally.
I'm assuming I'll need to create an array for both "sel_group" and "sel_cols" and then, I believe it's "implode" them into string values??? Am I thinking correctly???
I know this query won't work...but this is the direction I'm headed...
$query = "SELECT $sel_cols FROM tasks WHERE groups_id=$sel_groups";
IOW, the columns from the sel_cols array would go there, and the group or groups would go after the WHERE statement.
Then I guess I would have to figure out the code for the echo.
Am I at least in the ballpark???
Thank you and good night.
Jeff