Does any body know what wrong is with following code? It doesn't insert data into the database. Any help would be appreciated.
<?php
global $btnClicked;
global $myConn;
global $myRS;
global $CollItem;
global $EmpUserName;
global $vRecordToDelete;
global $RecordCount;
global $LocalRecordCount;
global $vTimeIn;
global $EmpNote;
global $EmpTimeOffReason;
global $vTimeOutglobal;
global $EmpTimeStamp;
global $Index;
$LocalRecordCount = 0; //Keeps track of the last record for current user.
$RecordCount= 0;
$Index = -1; //Initialize the desplay's table index.
extract($_POST); // Extracts data from the form in the previous page.
$btnClicked = $btnval;
if($btnClicked == "Time Out"){
echo "<HTML><HEAD><TITLE> Employee's History </TITLE>";
echo "<STYLE>.tblDiv {";
echo "LEFT: 12%; POSITION: absolute; TOP: 10% }";
echo "</STYLE>";
echo "<STYLE>";
echo "H2 {FONT-FAMILY: SANS-SERIF}";
echo "</STYLE>";
echo "<SCRIPT LANGUGE = \"JAVASCRIPT\" SRC = \"HighLi~1.js\">";
echo "</SCRIPT>";
echo "</HEAD>";
echo "<BODY leftMargin=0 topMargin=0 BGCOLOR = \"#e0ffff\">";
$UserName = $_COOKIE['user']; //Getting the user name from the global file
$FirstName = $_COOKIE['First'];
$LastName = $_COOKIE['Last'];
$EmpTimeStamp = $bxval; //Reding the value of the checkbox.
$EmpNote = $NoteText;
$EmpTimeOffReason = $Reason;
mysql_connect() or die("Problem connecting to the database");
if ($EmpTimeStamp == "Time stamp" ){
$query= "insert into EmpOutTable values( '$FirstName', '$LastName', DATE, TIME, \"0000\", \"0000\", '$EmpNote', '$EmpTimeOffReason', '$UserName', \"No\")";
$answer3 = mysql_db_query("AppDataBas
e", $query); // Updating the database.
}
else
{
$query= "insert into EmpOutTable
values( '$FirstName', '$LastName', \"0000\", \"0000\", \"0000\", \"0000\", '$EmpNote', '$EmpTimeOffReason', '$UserName', \"No\")";
$answer3 = mysql_db_query("AppDataBas
e", $query); // Updating the database.
}
mysql_free_result($answer3
);
</body></html>
Please note that this is a part of a longer program which has been cut for debugging reasons.
Start Free Trial