<?php 
//Created by Chad Edwards
//01-29-03
//Requires M.S. Access 2000 with DNS configured to helpdesk pass=''
//Revision 1
//Juim Help Desk
function HTML_Head() { 
    echo " 
    <HTML><HEAD> 
    <TITLE>Processing Form</TITLE> 
    </HEAD> 
    <BODY BGCOLOR=\"#CCCCCC\">"; 
} 

function HTML_Foot() { 
    echo "</body></html>"; 
} 


    /* 
        First, we create a connection to our ODBC source. This is done by creating 
        a connection. Once this is done, we are returned an ODBC connection number. 
        We use this number to use the ODBC functions within PHP. 
    */ 
	function Enter_New_Entry($Resolution)

{
//$dataVar = $_GET["record1"]; !!!!!!!!!!!!!!!!!!!!!!!!!
//$record1 = $_COOKIE["record1"]; //Recommended
$dataVar = $_COOKIE["record1"]; //Recommended

	print "</ul>";	
//make sure we do not have null values as inputs from our form.
    $cnx = odbc_connect( 'HelpDesk' , '', '' ); 
 	if ( $Resolution == "")
		{
		print "No resolution entered; moving on";
		}
		else
		{
		$cur= odbc_exec( $cnx, "UPDATE data SET Resolution = '$Resolution' WHERE ID =$dataVar" );  
		}
			
		$Closed =$_POST["Closed"];
		if ($Closed  == "")
		{
		print "<br>Did not close call; moving on</br>";
		}
		else
		{
		$cur= odbc_exec( $cnx, "UPDATE data SET Status = '$Closed' WHERE ID =$dataVar" ); 
		}
	    
		$idDelete =$_POST["idDelete"];
		if ($idDelete == "")
	 	{
			print ("Nothining Deleted");
	 	}
		else
		{
			$cur= odbc_exec( $cnx, "DELETE FROM data WHERE id = $idDelete");
			print ("ID $idDelete was removed from the Help Desk database!");
		}
		
		$itstaff =$_POST["itstaff"];
		if ($itstaff == "")
		{
		print "<br>Did not update I.T. Staff, moving on";
		}
		else
		{
		$cur= odbc_exec( $cnx, "UPDATE data SET staff = '$itstaff' WHERE ID =$dataVar" ); 
		}
		
		$priority =$_POST["priority"];
		if ($itstaff == "")
		{
		print "<br>Did not update call priority";
		}
		else
		{
		$cur= odbc_exec( $cnx, "UPDATE data SET Priority = '$priority' WHERE ID =$dataVar" ); 
		}
	
	
		
    //$SQL_Exec_String = "Insert Into data (Resolution) 
     //       Values ('$Resolution')"; 

  //  $cur= odbc_exec( $cnx, $SQL_Exec_String ); 
   
    odbc_close( $cnx); 
}

$dataVar = $_POST["Resolution"];
$strOldEntries = "Previous Entries in database"; 
$strNewEntries = "Updated version of databse (after entries)"; 

HTML_Head(); 
Enter_New_Entry($dataVar); 
HTML_Foot(); 
print "<br>";

print "Your entry has been sent to the database!";



?> 
<div align="center">
  <p>&nbsp;</p>
  <p><strong>Please click here to return to the <a href="DataAccess.php">Help 
    Desk Page.</a> </strong></p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><a href="http://www.quickintranet.com"><img src="http://www.quickintranet.com/infosec/quickintranet-com.jpg" border="0"></a><br>
    CopyRight 2004<br>
    QuickIntranet.com<br>
    <a href="http://www.quickintranet.com">http://www.QuickIntranet.com </a></p>
  <p align="center"><font size="5" face="Arial, Helvetica, sans-serif"></font></p>
</div>
