Author Topic: How to get a list of information?  (Read 193 times)

0 Members and 1 Guest are viewing this topic.

Offline miniuTopic starter

  • Enthusiast
  • Posts: 81
    • View Profile
How to get a list of information?
« on: March 12, 2010, 12:02:47 PM »
I have a problem. my designer is gone and left me with this project that I have to make some changes. I have a problem with this file. There is a list of games with assigned referees to a game. but this list shows only those games where are referees assigned before, but I want the the will show me all the games that need to be assigned.
<?php include("connect.php");
include(
"admin.session.php");
$LeftLinkSection 1;
$pagetitle="Referees To Game";

if(isset(
$_GET['did']))
{
	
$sql="delete from assigned_games where id=".$_GET['did'];
	
$res=mysql_query($sql);
	
echo 
mysql_error();
	
header('location:message.php?mid=27');
}

if(
$_POST['sub11']==1)
{
	
//echo 'ts'; 
}

if(
$_GET['league_id']!='')
	
$league=$_GET['league_id'];


?>
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<SCRIPT language="javascript" src="body.js"></SCRIPT>
<script>
function show_divisions(val)
{
	
window.location.href='manage_referees_to_game.php?league_id=' + val;
	

}
function show_getgames()
{
	
if(document.getElementById('txtfromdate').value!='' && document.getElementById('txttodate').value=='')
	
{
	
	
alert('Please Select To Date');
	
	
document.getElementById('txttodate').focus();
	
	
return false;
	
}
	
if(document.getElementById('txttodate').value!='' && document.getElementById('txtfromdate').value=='')
	
{
	
	
alert('Please Select From Date');
	
	
document.getElementById('txtfromdate').focus();
	
	
return false;
	
}
	
if(document.getElementById('txttodate').value < document.getElementById('txtfromdate').value)
	
{
	
	
alert('To Date can not be less then From Date');
	
	
document.getElementById('txttodate').focus();
	
	
return false;
	
}
	

	
document.getElementById('sub11').value=1;
	
document.frmgetgames.submit();
}
function clearall()
{
	
document.getElementById('txtfromdate').value='';
	
document.getElementById('txttodate').value='';
	
document.getElementById('refsel').value='';
	
document.getElementById('drpdivisions').value='';
	

}
function openWin(pageToLoad, winName, width, height, center,scrollbar){
	

	
  if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
	
	
        xposition = (screen.width - width) / 2;
	
	
        yposition = (screen.height - height - 100) / 2;
	
args = "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=no," + "scrollbars=" + scrollbar + "," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	
newWindow = window.open(pageToLoad,winName,args);
	

	
window.focus;
	
}
}
</script>
<script src="calendar.js"></script>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<link rel="stylesheet" href="main.css" type="text/css">
<style type="text/css">
<!--
.style3 {color: #FFFFFF}
-->
</style>
<style type="text/css">

/* media neutral styles go here */

@media print {
.noprint { display: none; }
}
</style>
</HEAD>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 class="th-a">
    <TR><TD height=60 valign="top"  colspan="2" bgColor="#ffffff"><div class="noprint"><? include("top.php") ?></div></td></TR>
  <tr>
  
	
	
<td width="20%" valign="top" bgcolor="#1c6995"><div class="noprint"><? include("left.php"); ?></div></td>
	
	
<td width="80%" valign="top" bgcolor="#FFFFFF" height="480">
	
	
	
<TABLE width="97%"  border=0 cellPadding=0 cellSpacing=0 align="center">
	
	
	
	
<TR><TD width="100%"  class="H1"><div class="noprint">&nbsp;</div></TD></TR>
	
	
	
	
<TR><TD align="center" width="100%" class="a-l"><div class="noprint"><?php echo $Message2 ?></div></TD></TR>
	
	
    <TR>
	
	
	
<div class="noprint"><? if($msg!="") { ?></div>
	
	
	
<TR><TD align="center" width="100%" class="a-l"><font color="red"><b><div class="noprint">User Deleted Successfully</div></b></font></TD></TR>
	
	
    <TR>
	
	
	
<? } ?>
	
	
      <TD width="100%" class="H1"><div class="noprint">Manage <?=$pagetitle?></div></TD>
	
	
    </TR>
	
	
	
	
<TR><TD background="images/vdots.gif"><div class="noprint"><IMG height=1 src="images/spacer.gif" width=1 border=0></div></TD></TR>
	
	
	
  <tr>
	
	
	
	
	
<TD>
	
	
	
	
	

	
	
	
	
	
<div class="noprint"><FORM  name="order" action="#" method="post"></div>
    
	
	
	
	
  <TABLE cellSpacing=0 cellPadding=1 border=0 >
	
	
	
	
	
	
	
	
<tr><td colspan="25" height="20"><div class="noprint"><b>View By Main Referee Name</b></div></td></tr>
	
	
	
	
	
	
	
	
<div class="noprint"><?=$prs_pageing->order();?></div>
	
	
	
	
	
	
</TABLE>
	
	
	
	
	
  </form>
	
	
	
	
	
  <br><div class="noprint"><form name="frmgetgames" id="frmgetgames" method="post"></div>
	
	
	
	
	
  <div class="noprint"><table cellpadding="0" cellspacing="0" border="0">
	
	
	
	

                              <td width="100%" colspan="2" align="left"><select id="refsel" name="refsel">
	
	
	
	
	
	
	
  <div class="noprint"><option value="" <? if($_POST['refsel']==' ') echo "selected='selected'"; ?>>--Select--</option></div>
	
	
<div class="noprint"><option value="0" <? if($_POST['refsel']!='') { if($_POST['refsel']==0) echo "selected='selected'"; } ?>>Games with NO REFEREE Assigned</option></div>
	
	
<div class="noprint"><option value="1" <? if($_POST['refsel']==1) echo "selected='selected'"; ?>>Games with NO Main Referee Assigned</option></div>
	
<div class="noprint"><option value="2" <? if($_POST['refsel']==2) echo "selected='selected'"; ?>>Games with NO Assistant Referee 1 Assigned</option></div>
<div class="noprint"><option value="3" <? if($_POST['refsel']==3) echo "selected='selected'"; ?>>Games with NO Assistant Referee 2 Assigned</option></div>
	
	
	
	
	
	
	
  </select>&nbsp;&nbsp;<select name="drpleague" id="drpleague" style="width:150px" onChange="show_divisions(this.value)">
	
	
	
	
	
	
	
  <div class="noprint"><option value="">--Select--</option></div>
	
	
	
	
	
	
	
  <div class="noprint"><? 
	
	
	
	
	
	
	
  
	
  $sql_league="select * from league";
	
	
	
	
	
	
	
	
  $res_league=mysql_query($sql_league);
	
	
	
	
	
	
	
	
  while($row_league=mysql_fetch_object($res_league))
	
	
	
	
	
	
	
	
  {
	
	
	
	
	
	
	
  ?></div>
	
	
	
	
	
	
	
  <div class="noprint"><option value="<?=$row_league->id?>" <? if($row_league->id==$league) echo "selected='selected'"; ?>><?=stripslashes($row_league->league_name)?></option></div>
	
	
	
	
	
	
	
  <? } ?>
	
	
	
	
	
	
	
  </select>&nbsp;&nbsp;<? if($league!='') { ?><div class="noprint"><select id="drpdivisions" name="drpdivisions"></div>
	
	
	
	
	
	
	
  
	
<div class="noprint"><option value="">--Select Division--</option></div>
	
	
	
	
	
	
	
	
<? 
	
	
	
	
	
	
	
	
	
$sql_division="select * from divisions where league_id=".$league." order by dname";
	
	
	
	
	
	
	
	
	
$res_division=mysql_query($sql_division);
	
	
	
	
	
	
	
	
	
while($row_division=mysql_fetch_object($res_division))
	
	
	
	
	
	
	
	
	
{
	
	
	
	
	
	
	
	
?>
	
	
	
	
	
	
	
	
<div class="noprint"><option value="<?=$row_division->id?>" <? if($_POST['drpdivisions']==$row_division->id) echo "selected='selected'"; ?>><?=stripslashes($row_division->dname);?></option></div>
	
	
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
	
  </select><? } ?>
	
	
	
	
	
	
	
  </td></tr>
	
	
	
	
	
	
	
<tr>
                              <td width="100%" colspan="2" align="center"><div class="noprint">
                            From Date:&nbsp;</div><input type="text" name="txtfromdate" readonly="true" id="txtfromdate" size="15" value="<?=stripslashes($_REQUEST['txtfromdate']);?>">&nbsp;<a href="#" onClick="getCalendar(document.getElementById('txtfromdate'));">&nbsp;Select Date</a>&nbsp;&nbsp;&nbsp;To Date:&nbsp;<input type="text" name="txttodate" readonly="true" id="txttodate" size="15" value="<?=stripslashes($_REQUEST['txttodate']);?>">&nbsp;<a href="#" onClick="getCalendar(document.getElementById('txttodate'));">&nbsp;Select Date</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Get Games" onClick="show_getgames();"><input type="hidden" id="sub11" name="sub11" value="0">&nbsp;&nbsp;<input type="button" value="Clear" onClick="clearall();">
                              </td>
                            </tr>
	
	
	
	
	
	
	
<tr><td colspan="2">&nbsp;</td></tr>
	
	
	
	
<tr>
	
	
	
	
</table></form><br>
	
	
	
	
	

	
<?
	

	
  
	
if($_GET["order"])
	
{
	
	
$order=$_GET["order"];
	
  $strQueryPerPage="select lea.league_name,ht.tname as htname,at.tname as atname,d.dname,g.gdate,g.gtime,ag.id,ag.gid,ag.main_ref_id,ag.ast_ref_id1,ag.ast_ref_id2,ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1.fname as r1fname,r1.lname as r1lname,r2.fname as r2fname,r2.lname as r2lname,r3.fname as r3fname,r3.lname as r3lname from assigned_games ag left outer join referees r1 on ag.main_ref_id=r1.id left outer join referees r2 on ag.ast_ref_id1=r2.id left outer join referees r3 on ag.ast_ref_id2=r3.id left outer join games g on ag.gid=g.gid left outer join divisions d on g.div_id=d.id left outer join league lea on g.league_id=lea.id left outer join teams ht on g.home_team_id=ht.id left outer join teams at on g.away_team_id=at.id where r1.fname like '$order%'";
	
}
	
else
	
  
	
$strQueryPerPage="select lea.league_name,ht.tname as htname,at.tname as atname,d.dname,g.gdate,g.gtime,ag.main_ref_id,ag.ast_ref_id1,ag.ast_ref_id2,ag.id,ag.gid,ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1.fname as r1fname,r1.lname as r1lname,r2.fname as r2fname,r2.lname as r2lname,r3.fname as r3fname,r3.lname as r3lname from assigned_games ag left outer join referees r1 on ag.main_ref_id=r1.id left outer join referees r2 on ag.ast_ref_id1=r2.id left outer join referees r3 on ag.ast_ref_id2=r3.id left outer join games g on ag.gid=g.gid left outer join divisions d on g.div_id=d.id left outer join league lea on g.league_id=lea.id left outer join teams ht on g.home_team_id=ht.id left outer join teams at on g.away_team_id=at.id where 1=1";
	

	
//echo $strQueryPerPage;
	

	
if($_POST['sub11']==1)
	
{
	
	
if($_REQUEST['txtfromdate']!='')
	
	
{
	
	
$txtfromdate=$_REQUEST['txtfromdate'];
	
	
$txtfromdate_arr=explode("-",$txtfromdate);
	
	
$txtfromdate=$txtfromdate_arr[2].'-'.$txtfromdate_arr[0].'-'.$txtfromdate_arr[1];
	

	
	
$txttodate=$_REQUEST['txttodate'];
	
	
$txttodate_arr=explode("-",$txttodate);
	
	
$txttodate=$txttodate_arr[2].'-'.$txttodate_arr[0].'-'.$txttodate_arr[1];
	

	
	
$strQueryPerPage.=" and g.gdate >='".$txtfromdate."' and g.gdate<='".$txttodate."'";
	
	
}
	
	

	
	
if($_POST['refsel']!='')
	
	
{
	
	
	
if($_POST['refsel']==0)
	
	
	
{
	
	
	
	
$strQueryPerPage.=" and ag.main_ref_id=0 and ag.ast_ref_id1=0 and ag.ast_ref_id2=0";
	
	
	
	

	
	
	
}
	
	
	
if($_POST['refsel']==1)
	
	
	
{
	
	
	
	
$strQueryPerPage.=" and ag.main_ref_id=0";
	
	
	
	

	
	
	
}
	
	
	
if($_POST['refsel']==2)
	
	
	
{
	
	
	
	
$strQueryPerPage.=" and ag.ast_ref_id1=0";
	
	
	
	

	
	
	
}
	
	
	
if($_POST['refsel']==3)
	
	
	
{
	
	
	
	
$strQueryPerPage.=" and ag.ast_ref_id2=0";
	
	
	
	

	
	
	
}
	
	
	

	
   }
	
   
	
   if($_POST['drpdivisions']!='')
	
   {
	
   
	
	
$strQueryPerPage.=" and d.id=".$_POST['drpdivisions'];
	
	
	
$drp_division=$_POST['drpdivisions'];
	
   }
	
   
	
   if($_POST['drpleague']!='')
	
   {
	
   
	
	
$strQueryPerPage.=" and lea.id=".$_POST['drpleague'];
	
	
	
$league=$_POST['drpleague'];
	
   }
	
	

	
	

	
}
	

	
if(isset($_GET['sort']))
	
	
$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
	
else
	
	
$strQueryPerPage.=" order by ag.id desc";

	
//echo $strQueryPerPage;

	
$strResultPerPage=mysql_query($strQueryPerPage);
	
$strTotalPerPage=mysql_affected_rows(); 
	

 ?>
	
	

          <FORM name="form2" action="#" method="post">
<td align="right"><a href="#" onClick="javascript:window.print();"><div class="noprint"><b>PRINT</b></div></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>          
          <TABLE width="100%" height="89" border=1 cellSpacing=0 class=t-a>
            <!--DWLayoutTable-->
            <TBODY>
              <TR class="th-a"> 
	
	
	
     <TD colspan="10">
	
	
	
	
	
 
	
	
	
	
	
 <div class="noprint"><?
	
	
	
	
	
	
$result=$prs_pageing->number_pageing($strQueryPerPage,15,7);
	
	
	
	
	
?>
	
</div>
	
	
  </TD>                 
        
	
 </TR>
	
	

	
	
	
 
              <TR class=th-a>
	
	
	
  
	
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=lea.league_name&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">League Name</a></TD>
                <TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=d.dname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Division</a></TD>
	
	
	
	
<TD width="8%" align="left"><a href="manage_referees_to_game.php?sort=g.gdate&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Date</a></TD>
	
	
	
	
<TD width="8%" align="left"><a href="manage_referees_to_game.php?sort=g.gtime&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Time</a></TD> 
	
	
	
	

	
	
	
	
<TD width="12%" align="left"><a href="manage_referees_to_game.php?sort=at.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Home Team</a></TD> 
	
	
	
	
<TD width="12%" align="left"><a href="manage_referees_to_game.php?sort=ht.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Away Team</a></TD> 
	
	
	
	
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r1.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Referee</a></TD> 
	
	
	
	
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r2.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 1</a></TD> 
	
	
	
	
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r3.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 2</a></TD> 
	
	
	
  
	
<TD width="10%" align="center"><span class="style3"><div class="noprint">Option</div></span></TD>
              </TR>
          <?php
	
	
  
$tr="#f4f4f4";
	
	
  
$clr=1;
	
	
	
while(
$row mysql_fetch_object($result))
	
	
	
{
	
	
	
	
	

	
	
	
	
if(
$tr=="#FFFFFF")
	
	
	
	
{
	
	
	
	
	
$tr="#efefef";
	
	
	
	
	
$col="#000000";
	
	
	
	
}
	
	
	
	
else
	
	
	
	
{
	
	
	
	
	
$tr="#FFFFFF";
	
	
	
	
	
$col="#000000";
	
	
	
	
}
	
	
	
	
$tmpid $row->id ;
	
	
	
	

	
	
	
	
$tmpid "";
	
	
	
	

	
	
	
	
$agid=$row->id;
	
	
	
	

        
?>
              <tr bgcolor="<? echo $tr; ?>">
	
	
	
 <TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->league_name); ?></font></TD>
      
	
    <TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->dname); ?></font></TD>
	
	
	
<TD  align="left"><font color="<?=$col?>">
	
	
	
<? 
	
	
	
	
$txtgdate=$row->gdate;
	
	
	
	
$txtgdate_arr=explode("-",$txtgdate);
	
	
	
	
$txtgdate=$txtgdate_arr[1].'-'.$txtgdate_arr[2].'-'.$txtgdate_arr[0];
	
	
	
	

	
	
	
?>
	
	
	
<? echo stripslashes($txtgdate); ?></font></TD>
	
	
	
<TD  align="left"><font color="<?=$col?>">
	
	
	
<? 
	
	
	
	
$txtgtime=$row->gtime;
	
	
	
	
$txtgtime_arr=explode("-",$txtgtime);
	
	
	
	
$txtgtime=$txtgtime_arr[1].'-'.$txtgtime_arr[2].'-'.$txtgtime_arr[0];
	
	
	
	

	
	
	
?>
	
	
	
<? echo stripslashes($txtgtime); ?></font></TD>
	
	
	
<TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->htname); ?></font></TD>
	
	
	
<TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->atname); ?></font></TD>
	
<TD  align="left"><font color="<?=$col?>">&nbsp;<? echo stripslashes($row->r1fname).' '.stripslashes($row->r1lname); ?><br><? if($row->main_ref_accept=='P' && $row->main_ref_id!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->main_ref_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->main_ref_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?mainref_id=$agid','test','550','500','true','yes');\">(View Reason)</a>"; ?></font></TD>
	
<TD  align="left"><font color="<?=$col?>">&nbsp;<? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->r2fname!='') { if($row->ast_ref1_accept=='P' && $row->ast_ref_id1!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->ast_ref1_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?astref_id1=$agid','test','550','500','true','yes');\">(View Reason)</a>"; } ?></TD>
	
<TD  align="left"><font color="<?=$col?>">&nbsp;<? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->r3fname!='') { if($row->ast_ref2_accept=='P' && $row->ast_ref_id2!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->ast_ref2_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?astref_id2=$agid','test','550','500','true','yes');\">(View Reason)</a>"; } ?></TD>
	
	
	
    <TD align="center"><div class="noprint"><input name="button" type="button" class="bttn-s" onClick="location.href='edit_referee_to_game.php?id=<?php echo $row->id?>'" value="Edit Assignment"></div>
	
	
	
      <div class="noprint"><INPUT class="bttn-s" onClick="deleteconfirm('Are you sure you want to delete this Assigned Referee to Game? \n','manage_referees_to_game.php?did=<?php echo($row->id); ?>');" type="button" value="Delete Assignment"></div>
	
	
	
	
</TD>
              </TR>
              <?  
	
	
	
  
	
	
$parentary = NULL ;
	
	
	
  
	
}
	
  ?>
            <input type=hidden name="total" value="<? echo $strTotalNewRow; ?>">
            <TR align=center> 
                <TD colSpan=10>
                <?
	
	
	
 
	
if(!$strTotalPerPage)
	
	
	
	
{
	
	
	
 ?>
                  <strong>No Referees To Game Detail Display</strong> 
                  <?
	
	
	
 
	
}
	
	
	
 ?>                </TD>
            </TR>
          </TABLE>
        
	
	

        </FORM>
	
	
	
	
	
</TD>
	
	
	
  </TR>
	
	
	
</TABLE>
	
	
</td>
  </tr>
</TABLE>
</BODY></HTML>

Offline miniuTopic starter

  • Enthusiast
  • Posts: 81
    • View Profile
Re: How to get a list of information?
« Reply #1 on: March 12, 2010, 12:36:49 PM »
I saw that this depends of the option "sub11"

For example I have an other file where I see the list of all games and there is "sub1" different configured. The code is below:
<?php include("connect.php");
include(
"admin.session.php");
$LeftLinkSection 1;
$pagetitle="Assign Referee To Game";
$qstr=$_SERVER['QUERY_STRING'];

if(
$_REQUEST["sub2"]==1)
{
	
$gid=$_REQUEST['gid'];
	

	
$sel="select id from assigned_games where gid=".$gid;
	
$res_sel=mysql_query($sel);
	
if(
mysql_num_rows($res_sel) > 0)
	
{
	
	
$msg=1;
	
}
	
else
	
{
	

	
$main_ref_id=$_REQUEST['mainref'];
	
$ast_ref_id1=$_REQUEST['astref1'];
	
$ast_ref_id2=$_REQUEST['astref2'];
	

	
$main_ref_fee=$_REQUEST['mainref_fee'];
	
$ast_ref1_fee=$_REQUEST['astref_fee'];
	
$ast_ref2_fee=$_REQUEST['astref_fee'];
	

	
$htmanager $_REQUEST['htmanager'];
	
$telephone $_REQUEST['telephone'];
	
$reffee $_REQUEST['reffee'];
	

	
$dname $_REQUEST['dname'];
	
$leaname $_REQUEST['leaname'];
	
$league_address $_REQUEST['league_address'];
	
$htname $_REQUEST['htname'];
	
$atname $_REQUEST['atname'];
	
$gdate $_REQUEST['gdate'];
	
$gtime $_REQUEST['gtime'];
	
$locname $_REQUEST['lname'];
	
$address $_REQUEST['address'];
	

	
if(
$main_ref_id=='')
	
	
$main_ref_id=0;
	

	
if(
$ast_ref_id1=='')
	
	
$ast_ref_id1=0;
	

	
if(
$ast_ref_id2=='')
	
	
$ast_ref_id2=0;
	

	
$sql_ins="insert into assigned_games set gid=$gid,main_ref_id=$main_ref_id,main_ref_fee='$main_ref_fee',ast_ref1_fee='$ast_ref1_fee',ast_ref2_fee='$ast_ref2_fee',ast_ref_id1=$ast_ref_id1,ast_ref_id2=$ast_ref_id2,assigner_id=".$_SESSION['UsErId']; 
	
$res_ins=mysql_query($sql_ins);
	
echo 
mysql_error();
	

	
$sql_ass="select fname,lname,email,phone from assigners where username='".$_SESSION["UsErOfAdMiN"]."'";
	
$res_ass=mysql_query($sql_ass);
	
$row_ass=mysql_fetch_object($res_ass);
	

	
$fnamea=$row_ass->fname;
	
$lnamea=$row_ass->lname;
	
$phone=$row_ass->phone;
	

	
$flname=$fnamea.' '.$lnamea;
	

	
if(
$main_ref_id!='')
	
{
	
	
$sql_mainref="select fname,lname,email from referees where id=".$main_ref_id;
	
$res_mainref=mysql_query($sql_mainref);
	
$row_mainref=mysql_fetch_object($res_mainref);
	

	
$fname=$row_mainref->fname;
	
$lname=$row_mainref->lname;
	
$email=$row_mainref->email;
	

	

	
$mailcontent="<html><head></head><body>
<table width='80%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr>
	
<td width='47%' height='56'>Dear <b>
$fname&nbsp;$lname</b>,</td>
	
<td width='117' align='center' nowrap='nowrap'></td>
</tr>

<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>You have been assigned to the following game by Assigner <strong>"
.$flname."</strong> and and You have been selected as <strong>Main Referee</strong>:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><strong>League:</strong>&nbsp;"
.stripslashes($leaname)."</td></tr>
<tr><td colspan='2'><strong>Division:</strong>&nbsp;"
.stripslashes($dname)."</td></tr>
<tr><td colspan='2'><strong>Main Referee Fee:</strong>&nbsp;$
$main_ref_fee</td></tr>
<tr><td colspan='2'><strong>Home Team Name:</strong>&nbsp;"
.stripslashes($htname)."</td></tr>
<tr><td colspan='2'><strong>Away Team Name:</strong>&nbsp;"
.stripslashes($atname)."</td></tr>
<tr><td colspan='2'><strong>Home Team Manager:</strong>&nbsp;"
.stripslashes($htmanager)."</td></tr>
<tr><td colspan='2'><strong>Telephone:</strong>&nbsp;
$telephone</td></tr>
<tr><td colspan='2'><strong>Game Date:</strong>&nbsp;
$gdate</td></tr>
<tr><td colspan='2'><strong>Game Time:</strong>&nbsp;
$gtime</td></tr>
<tr><td colspan='2'><strong>Location:</strong>&nbsp;"
.stripslashes($locname)."</td></tr>
<tr><td colspan='2'><strong>Location Address:</strong>&nbsp;"
.stripslashes($address)."</td></tr>
<tr><td colspan='2'><strong>Assigner's Telephone:</strong>&nbsp;
$phone</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Upon completion of the game, please fill out the attached Report <a href='http://www.njsa-assignments.com/report/report.doc' target='_blank'>http://www.njsa-assignments.com/report/report.doc</a> and mail it to the 
$leaname WITHIN 24 HOURS at the address below:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>"
.stripslashes($league_address)."</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Please login at following link to accept or reject Assigned Game:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><a href='
$sitepath' target='_blank'>$sitepath</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Regards,</td></tr>
<tr><td colspan='2'>John Zangrilli</td></tr>
<tr><td colspan='2'><a href='mailto:jzangrilli@njsa-assignments.com' target='_blank'>jzangrilli@njsa-assignments.com</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
</table>
</body>
</html>"
;

	
 
//echo $mailcontent; 

	
 
$to=$email;
	
 
$subject="Assigning details for game: ".stripslashes($htname)." VS ".stripslashes($atname);;
	
 
$from="no-reply@njsa-assignments.com";
	
 
	
/* echo $to.'<br>';
	
 echo $subject.'<br>';
	
 echo $from.'<br>';
	
 echo $mailcontent.'<br>'; exit;*/
	

	
@
SendHTMLMail1($to,$subject,$mailcontent,$from);
	

	
}
	

	
if(
$ast_ref_id1!='')
	
{
	
$sql_mainref="select fname,lname,email from referees where id=".$ast_ref_id1;
	
$res_mainref=mysql_query($sql_mainref);
	
$row_mainref=mysql_fetch_object($res_mainref);
	

	
$fname=$row_mainref->fname;
	
$lname=$row_mainref->lname;
	
$email=$row_mainref->email;
	

	

	

	
$mailcontent="<html><head></head><body>
<table width='80%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr>
	
<td width='47%' height='56'>Dear <b>
$fname&nbsp;$lname</b>,</td>
	
<td width='117' align='center' nowrap='nowrap'></td>
</tr>

<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>You have been assigned to the following game by Assigner <strong>"
.$flname."</strong> and and You have been selected as <strong>Assistant Referee 1</strong>:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><strong>League:</strong>&nbsp;"
.stripslashes($leaname)."</td></tr>
<tr><td colspan='2'><strong>Division:</strong>&nbsp;"
.stripslashes($dname)."</td></tr>
<tr><td colspan='2'><strong>Assistant Referee Fee:</strong>&nbsp;$
$ast_ref1_fee</td></tr>
<tr><td colspan='2'><strong>Home Team Name:</strong>&nbsp;"
.stripslashes($htname)."</td></tr>
<tr><td colspan='2'><strong>Away Team Name:</strong>&nbsp;"
.stripslashes($atname)."</td></tr>
<tr><td colspan='2'><strong>Home Team Manager:</strong>&nbsp;"
.stripslashes($htmanager)."</td></tr>
<tr><td colspan='2'><strong>Telephone:</strong>&nbsp;
$telephone</td></tr>
<tr><td colspan='2'><strong>Game Date:</strong>&nbsp;
$gdate</td></tr>
<tr><td colspan='2'><strong>Game Time:</strong>&nbsp;
$gtime</td></tr>
<tr><td colspan='2'><strong>Location:</strong>&nbsp;"
.stripslashes($locname)."</td></tr>
<tr><td colspan='2'><strong>Location Address:</strong>&nbsp;"
.stripslashes($address)."</td></tr>
<tr><td colspan='2'><strong>Assigner's Telephone:</strong>&nbsp;
$phone</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Upon completion of the game, please fill out the attached Report <a href='http://www.njsa-assignments.com/report/report.doc' target='_blank'>http://www.njsa-assignments.com/report/report.doc</a> and mail it to the 
$leaname WITHIN 24 HOURS at the address below:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>"
.stripslashes($league_address)."</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Please login at following link to accept or reject Assigned Game:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><a href='
$sitepath' target='_blank'>$sitepath</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Regards,</td></tr>
<tr><td colspan='2'>John Zangrilli</td></tr>
<tr><td colspan='2'><a href='mailto:jzangrilli@njsa-assignments.com' target='_blank'>jzangrilli@njsa-assignments.com</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
</table>
</body>
</html>"
;

	
 
$to=$email;
	
 
$subject="Assigning details for game: ".stripslashes($htname)." VS ".stripslashes($atname);
	
 
$from="no-reply@njsa-assignments.com";
	
 
	
 
//echo $mailcontent;
	

	
@
SendHTMLMail1($to,$subject,$mailcontent,$from);
	
	

	
}
	

	
if(
$ast_ref_id2!='')
	
{
	
$sql_mainref="select fname,lname,email from referees where id=".$ast_ref_id2;
	
$res_mainref=mysql_query($sql_mainref);
	
$row_mainref=mysql_fetch_object($res_mainref);
	

	
$fname=$row_mainref->fname;
	
$lname=$row_mainref->lname;
	
$email=$row_mainref->email;
	

	
$mailcontent="<html><head></head><body>
<table width='80%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr>
	
<td width='47%' height='56'>Dear <b>
$fname&nbsp;$lname</b>,</td>
	
<td width='117' align='center' nowrap='nowrap'></td>
</tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>You have been assigned to the following game by Assigner <strong>"
.$flname."</strong> and and You have been selected as <strong>Assistant Referee 2</strong>:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><strong>League:</strong>&nbsp;"
.stripslashes($leaname)."</td></tr>
<tr><td colspan='2'><strong>Division:</strong>&nbsp;"
.stripslashes($dname)."</td></tr>
<tr><td colspan='2'><strong>Assistant Referee Fee:</strong>&nbsp;$
$ast_ref2_fee</td></tr>
<tr><td colspan='2'><strong>Home Team Name:</strong>&nbsp;"
.stripslashes($htname)."</td></tr>
<tr><td colspan='2'><strong>Away Team Name:</strong>&nbsp;"
.stripslashes($atname)."</td></tr>
<tr><td colspan='2'><strong>Home Team Manager:</strong>&nbsp;"
.stripslashes($htmanager)."</td></tr>
<tr><td colspan='2'><strong>Telephone:</strong>&nbsp;
$telephone</td></tr>
<tr><td colspan='2'><strong>Game Date:</strong>&nbsp;
$gdate</td></tr>
<tr><td colspan='2'><strong>Game Time:</strong>&nbsp;
$gtime</td></tr>
<tr><td colspan='2'><strong>Location:</strong>&nbsp;"
.stripslashes($locname)."</td></tr>
<tr><td colspan='2'><strong>Location Address:</strong>&nbsp;"
.stripslashes($address)."</td></tr>
<tr><td colspan='2'><strong>Assigner's Telephone:</strong>&nbsp;
$phone</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Upon completion of the game, please fill out the attached Report <a href='http://www.njsa-assignments.com/report/report.doc' target='_blank'>http://www.njsa-assignments.com/report/report.doc</a> and mail it to the 
$leaname WITHIN 24 HOURS at the address below:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>"
.stripslashes($league_address)."</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Please login at following link to accept or reject Assigned Game:</td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'><a href='
$sitepath' target='_blank'>$sitepath</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
<tr><td colspan='2'>Regards,</td></tr>
<tr><td colspan='2'>John Zangrilli</td></tr>
<tr><td colspan='2'><a href='mailto:jzangrilli@njsa-assignments.com' target='_blank'>jzangrilli@njsa-assignments.com</a></td></tr>
<tr><td colspan='2'>&nbsp;</td></tr>
</table>
</body>
</html>"
;

	
//echo $mailcontent; exit;

	
 
$to=$email;
	
 
$subject="Assigning details for game: ".stripslashes($htname)." VS ".stripslashes($atname);;
	
 
$from="no-reply@njsa-assignments.com";
	

	
@
SendHTMLMail1($to,$subject,$mailcontent,$from);
	
	

	
}
	

	
//exit;
	
header("location:message.php?mid=26");
	
exit;
	
}
	

}

if(
$_REQUEST["sub1"]==1)
{
	
$sql_gamec="select id,gid from games where 1=1";

	
if(
$_REQUEST['txtfromdate']!='')
	
{
	
	
$txtfromdate=$_REQUEST['txtfromdate'];
	
	
$txtfromdate_arr=explode("-",$txtfromdate);
	
	
$txtfromdate=$txtfromdate_arr[2].'-'.$txtfromdate_arr[0].'-'.$txtfromdate_arr[1];
	
	

	
	
$txttodate=$_REQUEST['txttodate'];
	
	
$txttodate_arr=explode("-",$txttodate);
	
	
$txttodate=$txttodate_arr[2].'-'.$txttodate_arr[0].'-'.$txttodate_arr[1];
	
	

	
	
$sql_gamec.=" and gdate >='".$txtfromdate."' and gdate<='".$txttodate."'";
	
	

	
}
	

	
if(
$_REQUEST['drpdivisions']!='')
	
{
	
	
$sql_gamec.=" and div_id=".$_REQUEST['drpdivisions'];
	
}
	

	
	
if(
$_REQUEST['drpleague']!='')
	
   {
	
	
	
$sql_gamec.=" and league_id=".$_REQUEST['drpleague'];
	
	
	
$league=$_REQUEST['drpleague'];
	
   }
	

	
$sql_gamec.=" order by id desc";
	

	
//echo $sql_gamec; exit;
	

	
$res_gamec=mysql_query($sql_gamec);
	
$totgames=mysql_num_rows($res_gamec);
	
	

}
if(
$_REQUEST["sub2"]==1)
{
}
if(
$_GET["gid"])
{
	
$game_id=$_GET['gid'];
	

	

	
$selsql"SELECT lea.league_name,lea.address as league_address,d.mainref_fee,d.astref_fee,g.htmanager,g.telephone,g.id, g.gid,g.gdate,dayname(g.gdate) as gday,g.gtime, d.dname, ht.tname AS htname, at.tname AS atname, l.lname,l.address
FROM games g
INNER JOIN divisions d ON g.div_id = d.id
INNER JOIN league lea ON g.league_id = lea.id
INNER JOIN teams ht ON g.home_team_id = ht.id
INNER JOIN teams at ON g.away_team_id = at.id
INNER JOIN locations l ON g.location_id = l.id
where gid="
.$_GET["gid"]  ;
	
$selres mysql_query($selsql);
	
echo 
mysql_error();
	
$selobj mysql_fetch_object($selres);
	

	
$mainref_fee stripslashes($selobj->mainref_fee);
	
$astref_fee stripslashes($selobj->astref_fee);
	
$league_name stripslashes($selobj->league_name);
	
$league_address stripslashes($selobj->league_address);
	
$dname stripslashes($selobj->dname);
	
$htname stripslashes($selobj->htname);
	
$atname stripslashes($selobj->atname);
	

	
$htmanager stripslashes($selobj->htmanager);
	
$telephone stripslashes($selobj->telephone);
	

	
$gdate stripslashes($selobj->gdate);
	
$gdate2 stripslashes($selobj->gdate);
	
$kgdate=explode('-',$gdate);
	
$gdate=$kgdate[1].'-'.$kgdate[2].'-'.$kgdate[0];
	

	
$gtime stripslashes($selobj->gtime);
	

	
$htime=explode(':',$gtime);
	

	
$ampm=explode(' ',$htime[1]);
	

	
$lname stripslashes($selobj->lname);
	
$address stripslashes($selobj->address);
	

	
$gday=stripslashes($selobj->gday);
	

	
/*$sql_ref_fee="select * from referee_fees";
	
$res_ref_fee=mysql_query($sql_ref_fee);
	
$row_ref_fee=mysql_fetch_object($res_ref_fee);
	

	
$mainref_fee=$row_ref_fee->mainref_fee;
	
$astref_fee=$row_ref_fee->astref_fee;
	
	
*/
	
//echo $gday;
	
 
//echo $sql_mainref="select id,fname,lname from referees where '".$gdate2."' NOT BETWEEN fromdate and todate";  
	
	

	
	
	
	

}

if(
$_GET['league_id']!='')
	
$league=$_GET['league_id'];
	

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<script language="javascript">
function kyb_check()
{
	
if(document.getElementById("drpgames").value=="")
	
{
	
	
alert("Please Select Game");
	
	
document.getElementById("drpgames").focus();
	
	
return false;
	
}
	

	
if(document.getElementById("astref1")!=null && document.getElementById("mainref")!=null)
	
{
	
	
if(document.getElementById("mainref").value!='' && document.getElementById("astref1").value!='')
	
	
{
	
	
	
if(document.getElementById("mainref").value==document.getElementById("astref1").value)
	
	
	
{
	
	
	
	
alert("Main Referee and Assistant Referee can not be Same");
	
	
	
	
document.getElementById("mainref").focus();
	
	
	
	
return false;
	
	
	
}
	
	
}
	
}
	

	
if(document.getElementById("astref2")!=null && document.getElementById("mainref")!=null)
	
{
	
	
if(document.getElementById("mainref").value!='' && document.getElementById("astref2").value!='')
	
	
{
	
	
	
if(document.getElementById("mainref").value==document.getElementById("astref2").value)
	
	
	
{
	
	
	
	
alert("Main Referee and Assistant Referee can not be Same");
	
	
	
	
document.getElementById("mainref").focus();
	
	
	
	
return false;
	
	
	
}
	
	
}
	
}
	

	
if(document.getElementById("astref1")!=null && document.getElementById("astref2")!=null)
	
{
	
	
if(document.getElementById("astref1").value!='' && document.getElementById("astref2").value!='')
	
	
{
	
	
	
if(document.getElementById("astref1").value==document.getElementById("astref2").value)
	
	
	
{
	
	
	
	
alert("Assistant Referee 1 and Assistant Referee 2 can not be Same");
	
	
	
	
document.getElementById("astref1").focus();
	
	
	
	
return false;
	
	
	
}
	
	
}
	
}
	

}
function clearall()
{
	
document.getElementById('txtfromdate').value='';
	
document.getElementById('txttodate').value='';
	
document.getElementById('drpdivisions').value='';
}
function IsNumericMain(strString)
   //  check for valid numeric strings
	

   {
    var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
	
	
 alert("Please Enter Digits");
	
	
 document.getElementById('main_ref_fee').value='';
	
	
 document.getElementById('main_ref_fee').focus();
         blnResult = false;
         }
      }
   return blnResult;
   }
function IsNumericAstRef1(strString)
{
    var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
	
	
 alert("Please Enter Digits");
	
	
 document.getElementById('ast_ref1_fee').value='';
	
	
 document.getElementById('ast_ref1_fee').focus();
         blnResult = false;
         }
      }
   return blnResult;
}
function IsNumericAstRef2(strString)
{
    var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
	
	
 alert("Please Enter Digits");
	
	
 document.getElementById('ast_ref2_fee').value='';
	
	
 document.getElementById('ast_ref2_fee').focus();
         blnResult = false;
         }
      }
   return blnResult;
}

function select_game(val,sub1,txtfrom,txtto,drp_division)
{
	
window.location.href='assign_referee_to_game.php?gid=' + val + '&sub1=' + sub1 + '&txtfromdate=' + txtfrom + '&txttodate=' + txtto + '&drpdivisions=' + drp_division;
	

}
function show_divisions(val)
{
	
window.location.href='assign_referee_to_game.php?league_id=' + val;
	

}
function show_getgames()
{
	
if(document.getElementById('txtfromdate').value!='' && document.getElementById('txttodate').value=='')
	
{
	
	
alert('Please Select To Date');
	
	
document.getElementById('txttodate').focus();
	
	
return false;
	
}
	
if(document.getElementById('txttodate').value!='' && document.getElementById('txtfromdate').value=='')
	
{
	
	
alert('Please Select From Date');
	
	
document.getElementById('txtfromdate').focus();
	
	
return false;
	
}
	
if(document.getElementById('txttodate').value < document.getElementById('txtfromdate').value)
	
{
	
	
alert('To Date can not be less then From Date');
	
	
document.getElementById('txttodate').focus();
	
	
return false;
	
}

	
document.getElementById('sub1').value=1;
	
document.frmgetgames.submit();
}

</script>
<script src="calendar.js"></script>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<link rel="stylesheet" href="main.css" type="text/css">
</HEAD>
<BODY  leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 class="th-a">
  <TR><TD height=60   colspan="2" bgColor=#FFFFFF><? include("top.php") ?></td>
  </TR>
  <tr>
	
	
<td width="20%" valign="top" bgcolor="#1c6995"><? include("left.php"); ?></td>
	
	
<td width="80%" valign="top" height="480" bgcolor="#FFFFFF">
	
	
	
<TABLE  cellSpacing=0 cellPadding=0  border=0 width="90%" align="center">
	
	
	
	
<TR><TD width="100%"  class=h1>&nbsp;</TD></TR>
	
	
	
	
<TR><TD width="100%"  class=H1><? echo ($_GET["id"]>0)?"Edit":"Add"; ?> <?=$pagetitle?></TD></TR>
	
	
	
	
<TR><TD background="images/vdots.gif"></TD></TR>
	
	
	
	
<tr><td>&nbsp;</td></tr>
	
	
	
	
<tr><td>&nbsp;</td></tr>
	
	
	
	
<tr><td align="center"><form name="frmgetgames" id="frmgetgames" method="post">
	
	
	
	
<table cellpadding="0" cellspacing="0" border="0">
	
	
	
	
<tr>
                              <td width="100%" colspan="2" align="left">
                            From Date:&nbsp;<input type="text" name="txtfromdate" readonly="true" id="txtfromdate" size="15" value="<?=stripslashes($_REQUEST['txtfromdate']);?>">&nbsp;<a href="#" onClick="getCalendar(document.getElementById('txtfromdate'));">&nbsp;Select Date</a>&nbsp;&nbsp;&nbsp;To Date:&nbsp;<input type="text" name="txttodate" readonly="true" id="txttodate" size="15" value="<?=stripslashes($_REQUEST['txttodate']);?>">&nbsp;<a href="#" onClick="getCalendar(document.getElementById('txttodate'));">&nbsp;Select Date</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>
	
	
	
	
	
	
	
<select name="drpleague" id="drpleague" style="width:150px" onChange="show_divisions(this.value)">
	
	
	
	
	
	
	
  <option value="">--Select--</option>
	
	
	
	
	
	
	
  <? 
	
	
	
	
	
	
	
  
	
  $sql_league="select * from league";
	
	
	
	
	
	
	
	
  $res_league=mysql_query($sql_league);
	
	
	
	
	
	
	
	
  while($row_league=mysql_fetch_object($res_league))
	
	
	
	
	
	
	
	
  {
	
	
	
	
	
	
	
  ?>
	
	
	
	
	
	
	
  <option value="<?=$row_league->id?>" <? if($row_league->id==$league) echo "selected='selected'"; ?>><?=stripslashes($row_league->league_name)?></option>
	
	
	
	
	
	
	
  <? } ?>
	
	
	
	
	
	
	
  </select>&nbsp;&nbsp;&nbsp;&nbsp;
	
	
	
	
	
	
	
  <? if($league!='') { ?>
	
	
	
	
	
	
	
<select id="drpdivisions" name="drpdivisions">
	
	
	
	
	
	
	
  
	
<option value="">--Select Division--</option>
	
	
	
	
	
	
	
	
<? 
	
	
	
	
	
	
	
	
	
$sql_division="select * from divisions where league_id=".$league." order by dname";
	
	
	
	
	
	
	
	
	
$res_division=mysql_query($sql_division);
	
	
	
	
	
	
	
	
	
while($row_division=mysql_fetch_object($res_division))
	
	
	
	
	
	
	
	
	
{
	
	
	
	
	
	
	
	
?>
	
	
	
	
	
	
	
	
<option value="<?=$row_division->id?>" <? if($_REQUEST['drpdivisions']==$row_division->id) echo "selected='selected'"; ?>><?=stripslashes($row_division->dname);?></option>
	
	
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
	
  </select><? } ?><br><br>
	
	
	
	
	
	
	
<input type="button" value="Get Games" onClick="show_getgames();"><input type="hidden" id="sub1" name="sub1" value="0">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Clear" onClick="clearall();">
                              </td>
                            </tr>
	
	
	
	
	
	
	

	
	
	
	
</table></form>
	
	
	
	
</td></tr>
	
	
	
	
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
	
	
	
	
<tr><td>&nbsp;</td></tr>
	
	
	
	
<? if($msg==1) { ?>
	
	
	
	
<tr><td class="error" height="30"><font color="red"><strong>Game is already assigned to Referees!</strong></font></td></tr>
	
	
	
	
<? } ?>
	
	
	
	
<TR>
	
	
	
	
	
<TD>
	
	
	
	
	
	
<? if(($_REQUEST['sub1']==1 && $totgames > 0) || ($_GET['gid']!='' && $totgames > 0)) { ?>
	
	
	
	
	
	
<form method="post" enctype="multipart/form-data" name="frm">
	
	
	
	
	
	
  <table width="90%" border="0" align="left" cellpadding="3" cellspacing="3" class="solidinput">
                            <tr>
                              <td colspan="2" align="right" class="menu-a"><span class="a-l">* indicates required field</span>&nbsp;&nbsp;</td>
                            </tr>
                            <tr>
                              <td class="H4" colspan="2" align="left"><?=$pagetitle?>
                                </td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red">*</font>&nbsp;Select Game:</td>
                              <td width="63%"><font color="<?=$col?>">
                                <select name="drpgames" id="drpgames" style="width:300px" onChange="select_game(this.value,'<?=$_REQUEST['sub1']?>','<?=$_REQUEST['txtfromdate']?>','<?=$_REQUEST['txttodate']?>','<?=$_REQUEST['drpdivisions']?>');">
	
	
	
	
	
	
	
	
<option value="">--Select Game--</option>
	
	
	
	
	
	
	
	
<? 
	
	
	
	
	
	
	
	
	
$sql_game="SELECT lea.league_name,lea.address as league_address,d.mainref_fee,d.astref_fee,g.htmanager,g.telephone,g.id,g.gid,g.gdate,dayname(g.gdate) as gday,g.gtime, d.dname, ht.tname AS htname, at.tname AS atname, l.lname,l.address
FROM games g
INNER JOIN divisions d ON g.div_id = d.id
INNER JOIN league lea ON g.league_id = lea.id
INNER JOIN teams ht ON g.home_team_id = ht.id
INNER JOIN teams at ON g.away_team_id = at.id
INNER JOIN locations l ON g.location_id = l.id where 1=1";

	
	
	
	
	
	
if($txtfromdate!='')
	
	
	
	
	
	
{

	
	
	
	
	
	
	
$sql_game.=" and g.gdate >='".$txtfromdate."' and g.gdate<='".$txttodate."'";
	
	
	
	
	
	
}
	
	
	
	
	
	

	
	
	
	
	
	
if($_REQUEST['drpdivisions']!='')
	
	
	
	
	
	
{
	
	
	
	
	
	
	
$sql_game.=" and g.div_id=".$_REQUEST['drpdivisions'];
	
	
	
	
	
	
}
	
	
	
	
	
	

	
	
	
	
	
	
 if($_REQUEST['drpleague']!='')
	
	
	
	
	
	
   {
	
	
	
	
	
	
	
	
$sql_game.=" and lea.id=".$_REQUEST['drpleague'];
	
	
	
	
	
	
	
	
$league=$_REQUEST['drpleague'];
	
	
	
	
	
	
   }
	
	
	
	
	
	

	
	
	
	
	
	

	
	
	
	
	
	

	
	
	
	
	
	
	
	
	
$res_game=mysql_query($sql_game);
	
	
	
	
	
	
	
	
	
while($row_game=mysql_fetch_object($res_game))
	
	
	
	
	
	
	
	
	
{
	
	
	
	
	
	
	
	
?>
	
	
	
	
	
	
	
	
<option value="<?=$row_game->gid;?>" <? if($game_id==$row_game->gid) echo "selected='selected'"; ?>><? echo $row_game->league_name.'=>'.$row_game->dname.'=>'.$row_game->htname.' VS '.$row_game->atname;?></option>
	
	
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
	
	
</select>
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<? if($_GET['gid']!='') { ?>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;League:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$league_name;?><input type="hidden" id="leaname" name="leaname" value="<?=$league_name?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;League Address:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$league_address;?><input type="hidden" id="league_address" name="league_address" value="<?=$league_address?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Division:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$dname;?><input type="hidden" id="dname" name="dname" value="<?=$dname?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Home Team:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$htname;?><input type="hidden" id="htname" name="htname" value="<?=$htname?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Away Team:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$atname;?><input type="hidden" id="atname" name="atname" value="<?=$atname?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Home Team Manager:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$htmanager;?><input type="hidden" id="htmanager" name="htmanager" value="<?=$htmanager?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Telephone:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$telephone;?><input type="hidden" id="telephone" name="telephone" value="<?=$telephone?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Date of Game:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$gdate;?><input type="hidden" id="gdate" name="gdate" value="<?=$gdate?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Game Time:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$gtime;?><input type="hidden" id="gtime" name="gtime" value="<?=$gtime?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Location:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$lname;?><input type="hidden" id="lname" name="lname" value="<?=$lname?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Location Address:</td>
                              <td width="63%"><font color="<?=$col?>"><?=$address;?><input type="hidden" id="address" name="address" value="<?=$address?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<? if($mainref_fee!='') { ?>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Referee:</td>
                              <td width="63%">
	
	
	
	
	
	
	
  <font color="<?=$col?>"><select id="mainref" name="mainref" style="width:180px">
	
	
	
	
	
	
	
  
	
<option value="">--Select--</option>
	
	
	
	
	
	
	
  <?
	
	
	
	
	
	
	
  
	
	
$sql_mainref = "SELECT id, lname, fname FROM `referees` WHERE '".$gdate2."' NOT BETWEEN fromdate AND todate ORDER BY lname";
	
	
	
	
	
	
	
	
	
$res_mainref=mysql_query($sql_mainref);
	
	
	
	
	
	
	
	
	
while($row_mainref=mysql_fetch_object($res_mainref))
	
	
	
	
	
	
	
	
	
{ ?>
	
	
	
	
	
	
	
	
	
<option value="<?=$row_mainref->id?>"><?=$row_mainref->lname.' '.$row_mainref->fname?></option>
	
	
	
	
	
	
	
	
<?
	
}
	
	
	
	
	
	
	
  ?>
	
	
	
	
	
	
	
  </select>
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<? } else { ?>
	
	
	
	
	
	
<input type="hidden" name="old_main_ref_id" id="old_main_ref_id" value="<?=$main_ref_id?>">
	
	
	
	
	
	
<input type="hidden" name="mainref_fee" value="<?=$mainref_fee?>">
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
<? if($astref_fee!='') { ?>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Assistant Referee 1:</td>
                              <td width="63%"><font color="<?=$col?>"><select id="astref1" name="astref1" style="width:180px">
	
	
	
	
	
	
	
  
	
<option value="">--Select--</option>
	
	
	
	
	
	
	
  <?
	
	
	
	
	
	
	
  
	
	
$sql_astref1="select id,fname,lname from referees where '".$gdate2."' NOT BETWEEN fromdate and todate ORDER BY lname"; 
	
	
	
	
	
	
	
	
	
$res_astref1=mysql_query($sql_astref1);
	
	
	
	
	
	
	
	
	
while($row_astref1=mysql_fetch_object($res_astref1))
	
	
	
	
	
	
	
	
	
{ ?>
	
	
	
	
	
	
	
	
	
<option value="<?=$row_astref1->id?>"><?=$row_astref1->lname.' '.$row_astref1->fname?></option>
	
	
	
	
	
	
	
	
<?
	
}
	
	
	
	
	
	
	
  ?>
	
	
	
	
	
	
	
  </select>
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<? } else { ?>
	
	
	
	
	
	
<input type="hidden" name="old_ast_ref_id1" id="old_ast_ref_id1" value="<?=$ast_ref_id1?>">
	
	
	
	
	
	
<input type="hidden" name="astref_fee" value="<?=$astref_fee?>">
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
<? if($astref_fee!='') { ?>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Assistant Referee 2:</td>
                              <td width="63%"><font color="<?=$col?>"><select id="astref2" name="astref2" style="width:180px">
	
	
	
	
	
	
	
  
	
<option value="">--Select--</option>
	
	
	
	
	
	
	
  <?
	
	
	
	
	
	
	
  
	
	
$sql_astref2="select id,fname,lname from referees where '".$gdate2."' NOT BETWEEN fromdate and todate ORDER BY lname"; 
	
	
	
	
	
	
	
	
	
$res_astref2=mysql_query($sql_astref2);
	
	
	
	
	
	
	
	
	
while($row_astref2=mysql_fetch_object($res_astref2))
	
	
	
	
	
	
	
	
	
{ ?>
	
	
	
	
	
	
	
	
	
<option value="<?=$row_astref2->id?>"><?=$row_astref2->lname.' '.$row_astref2->fname?></option>
	
	
	
	
	
	
	
	
<?
	
}
	
	
	
	
	
	
	
  ?>
	
	
	
	
	
	
	
  </select>
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Referee's Fee:</td>
                              <td width="63%"><font color="<?=$col?>">$<?=$mainref_fee?><input type="hidden" name="mainref_fee" value="<?=$mainref_fee?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Assistant Referee 1's Fee:</td>
                              <td width="63%"><font color="<?=$col?>">$<?=$astref_fee?><input type="hidden" name="astref_fee" value="<?=$astref_fee?>">
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<tr>
                              <td width="37%" align="right"><font color="red"></font>&nbsp;Assistant Referee 2's Fee:</td>
                              <td width="63%"><font color="<?=$col?>">$<?=$astref_fee?>
                              </font></td>
                            </tr>
	
	
	
	
	
	
	
<? } else { ?>
	
	
	
	
	
	
<input type="hidden" name="old_ast_ref_id2" id="old_ast_ref_id2" value="<?=$ast_ref_id2?>">
	
	
	
	
	
	
<input type="hidden" name="astref_fee" value="<?=$astref_fee?>">
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
	
<? } ?>
	
	
	
	
	
	
	

                            <tr>
                              <td>&nbsp;
                                  <input type="hidden" value="<?=$_GET["id"]; ?>" name="id"></td>
                              <td><input name="Submit" type="submit" class="buttonclass" value="Submit" onClick="return kyb_check();" /></td>
                              <input type="hidden" name="sub2" value="1">
                            </tr>
                          </table></form><? } else { ?><? if($_POST['sub1']!='') { ?><table cellpadding="0" cellspacing="0" border="0" align="center">
	
	
	
	
	
	
  <tr><td class="error" height="30"><font color="red"><strong>No Games will be played between these Dates!</strong></font></td></tr>
	
	
	
	
	
	
  </table><? } ?>
	
	
	
	
	
	
  <? } ?>
	
	
	
	
	
	
 
	
	
	
	
	
	
 </TD>
	
	
	
	
</TR>
	
	
	
</TABLE>
	
	
</td>
  </tr>
</TABLE>
</BODY></HTML>




Offline miniuTopic starter

  • Enthusiast
  • Posts: 81
    • View Profile
Re: How to get a list of information?
« Reply #2 on: March 14, 2010, 09:18:58 PM »
HELP! HELP, HELP