not gettingg desired results... is my programming logic run amuck...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings:

I am having a problem with some php that I have written...  In an
attempt to clearly state the problem and how it is supposed to work
the following may be lengthy, to which I appologize for.

I am not getting the results that I am expecting.  I am using the
following url  to access my page.

http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&get_switch=0


the ahrc_programleader.php file is supposed to use  switch/case
statement to determine what action to take:

switch ($_GET['get_switch']){
	case "0":
		displayMenu($_GET['SID']);
		break;
	case "1":
		attendanceReport($_GET['SID']);
		break;
	case "2":
		attendanceSheet($_GET['SID']);
		break;
	default:
		// Return Error Message ## TO BE CODED LATER
		// Reprint Menu 
}

In the displayMenu() function it is  (1) supposed to print out a link
to get an Attendance Sheet for the SID and  (2) check if an attendance
report exists using the isAttendance Report() function... if there is
it prints out a link to it (ahrc_programleader.php with SID=$SID and
get_switch = 1. Otherwise it prints out "No Attendance Report
Available".  the function isAttendanceReport() is supposed to return
either a 0 if no report or invalid session id or 1 for is a report.

function displayMenu($SID){
echo "<a href=\"ahrc_programleader.php?SID=".$SID."&get_switch=2\">Print
Attendance Sheet </a><br />\n";
if(isAttendanceReport($SID)) 
	echo "<a href=\"ahrc_programleader.php?SID=". $SID .
"&get_switch=1\"> Print Attendance Report </a> <br>\n";
else
{
	echo "No Attendance Report Available"; 
	echo $SID; // DEBUG CODE 
}

#echo "Enter Attendance <br> \n";    ## TO BE CODED LATER
#echo "Print Progress Notes <br>\n"; ## TO BE CODED LATER
#echo "Print Progress Notes with Attendance <br>\n";  ## TO BE CODED LATER
#echo "View Participants<br>\n";  
}

I know for a fact that an attendance report exists for the given SID.
Because when I manually put in the URL with the get_switch value = 1
(http://localhost/AHRC_PL/ahrc_programleader/ahrc_programleader.php?SID=1&get_switch=1)
it displays the report.

When I was testing the code after it not returning results, I had
attempted to make sure that it was going through the logic and was
reaching the return 1; statement and it was... so I am perplexed...

Below I have placed links to the full code for both pages.



Additional code file: isAttendanceReport.php code is available at
http://pastebin.com/133993

Additional code file: ahrc_programleader.php code is available at
http://pastebin.com/134014


Thank You in advance
Gary

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux