473,237 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

Stuck & Need Help with "Generate Report"


Ok, I admit it, I bit off a bit more than I can chew.

I need to complete this "Generate Report" page for my employer and I'm
a little over my head. I could use some additional assistance. I say
additional because I've already had help which is greatly appreciated.
I do try to take the time and understand the provided script in hopes
on not having to trouble others on those. But here it goes...

I need to allow the user to generate a report and thus have created a
file called generate_report.php.

I have a header.html and footer.html file so I'm just trying to fill
in the middle.

What I want to do is create a single file to display and process the

What I have is a set of records from three different groups. I want
to allow the user to select what group's records he would like to
extract data from and what columns he wants displayed. So, I have
basically two columns in the form: 1) what group(s) and 2) what

Now, the "what group(s)" column has a script to extract the list of
groups from a table of the same name and display it as a checkbox

The other column, "select columns" is a simple checkbox listing.

So, ideally, when the page is brought up for the first time, it'll
recognize the "submit" button hasn't been hit and will display the
form. Once the user selects group(s) and column(s) and hits submit
(or in this case "Generate), the output would be a page with the
columns aligned horizontally and data underneath each header (just
like a spredsheet).

So, this is what I think I need:

1) A script that will process the sel_groups and sel_cols arrays
(which has been provided but not tested); and

2) an echo statement that'll produce the desired output.

I'm going to fart around with it some more but would really appreciate
some help.

Oh, one question that just popped up (and I'll reseach it)...

can I have this page split PHP | HTML |PHP when using the "if
submitted" statement? Seems like I would need to have just a single
php file so that if sumbitted, here is the query and output BUT if not
submitted, here is the form. Hmmm...I need to think that one through
a bit more.




// Begin the page now.
$page_title = 'Generate Report';
include ('./includes/header.html');
//require_once ('includes/mysql_connect.php'); // Connect to
the db.

// Check if the form has been submitted.
if (isset($_POST['submitted'])) {

require_once ('includes/mysql_connect.php'); // Connect to the

// this script only build query
switch ($_REQUEST['submit']){
case "Generate":

// first extract group
$query = "";
if(count($_REQUEST['sel_group']) > 0){
$wval = array ();
foreach($_REQUEST['sel_group'] as $k => $v){
$wval[] = "groups_id='{$v}'";

//extract the columns
$scols = array ();
if(count($_REQUEST['sel_cols]']) > 0){
foreach($_REQUEST['sel_group'] as $k => $v){
$scols[] = "{$v}";

//building query
$where = join(' AND ', $wval);
$sel_cols = join(',', $scols);
$query = "SELECT {$sel_cols} FROM tasks WHERE


//if $query is empty you can catch this case as an error
because there is not any group or selected columns



//reset your form
//} End of submit conditional.
//Output Form
// Always show the form.

} else { // Not a valid user ID.
echo '<h1 id="mainhead">Page Error</h1>
<p class="error">This page has been accessed in
error.</p><p><br /><br /></p>';

mysql_close(); // Close the database connection.

// End of links section.


<!--Create the form.-->
<fieldset><legend>Generate Report</legend>

<form action="handle_generate_report.php"

<TABLE BORDER="1" cellpadding="5"
<TD rowspan="2"
valign="bottom"><strong>Select ICAO Group(s)</strong></TD>
colspan="2"><strong>Select Columns</strong></TD>
<TD><strong>ICAO Work
Programme</strong></TD><TD><strong>SME Input</strong></TD>
<TD align="left"
('includes/mysql_connect.php'); // Connect to the db.
$query = "SELECT *
FROM groups ORDER BY groups_id ASC";
$result = @mysql_query

while($rows =
$id =
$rows['groups_id'] ;
$name =

echo "<input
name=\"sel_group[]\" type=\"checkbox\" value=\"$id\">$name<BR>";
<TD align="left" valign="top">
<input name="sel_cols"
type="checkbox" value="groups_name">ICAO Group Name<BR>
<input name="sel_cols"
type="checkbox" value="task_icaodesc">ICAO Description of Task<BR>
<input name="sel_cols"
type="checkbox" value="icaotask_id">ANC Task No.<BR>
<input name="sel_cols"
type="checkbox" value="task_compdate">Estimated Completion Date<BR>
<input name="sel_cols"
type="checkbox" value="task_icaosource">Source &amp; References<BR>
<input name="sel_cols"
type="checkbox" value="task_icaonote">ICAO Note on Progress<BR>
<TD align="left" valign="top">
<input name="sel_cols"
type="checkbox" value="task_usposition">U.S. Position<BR>
<input name="sel_cols"
type="checkbox" value="task_exp_outcome">Expected Outcome<BR>
<input name="sel_cols"
type="checkbox" value="task_outcome">Outcome<BR>
<input name="sel_cols"
type="checkbox" value="task_usaction">U.S. Action<BR>
<input name="sel_cols"
type="checkbox" value="task_probs_issues">Problems &amp; Issues<BR>
<input name="sel_cols"
type="checkbox" value="task_smecomments">Notes/Comments<BR>


<input name="submit"
type="button" value="Generate">


<!-- End of Content -->

include ('includes/footer.html')
Feb 25 '06 #1
0 2211

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: sztonix | last post by:
Hi all, I encountered a crystal report deployment problem. I make reports with Crystal Report for Visual Studio .NET 2003. It works fine in the development machine. And then make setup...
by: Will | last post by:
Hi all, The documentation for NGEN states "If Ngen.exe encounters any methods in an assembly that it cannot generate, it excludes them from the native image. When the runtime executes this...
by: Tom Louchbaum | last post by:
When I preview my Access 2000 Report it looks fine. When I Email the report using DoCmd.SendObject acSendReport, "Report", acFormatRTF, "To Address", , , "Subject", , False the resulting...
by: Ellen Manning | last post by:
I've got an A2K report showing students and their costs. Student info is in the main report and costs are in a subreport for each student. The user inputs the program desired then only those...
by: laddie1997 | last post by:
When I try to create a report in Access 2003, the error message "the wizard is unable to create your report" comes up. My printer is a network printer and no local printer is attached. I can get...
by: Delali Dzirasa | last post by:
I am a newbie and am creating my first asp.net in crystal reports. I have created the report (.rpt file) and have dropped the CrystalReportViewer on the web form. From the databinding...
by: Dentharg | last post by:
Hi! How can I rename this tab in Crystal Report Viewer from "Main Report" to something else? Thanks!
by: Anneybo | last post by:
Alright, I give up! I'm asking the experts. I have created a database that calculates PTO for employees. I need to be able to cache the report by user entered dates and specific employee names. I...
by: Micheal | last post by:
Greetings Access Group, Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.