Location: PHPKode > projects > E2Exam: LAMP for the Education > addcodes.php
<?
require("db.php");
?>
<html>

<head>
<title>Add Codes</title>
</head>

<body topmargin="0" leftmargin="0" onload="javascript:document.addon.tdeptid.focus();">
<div align="center">
<center>
<?
$sqlquery = "select * from Examinee";
$addquery = "insert into Examinee(EID) values ('$tdeptid')";
$verquery = "select * from Examinee where EID='$deptid'";
$delquery = "delete from Examinee where EID=$tradio";
$updatequery = "update Examinee set EID='$tdeptid' EID=$tdeptid";
$editquery = "select * from Examinee where EID=$tradio";


if(isset($tsubmit))
{
	if(trim($tdeptid)==""){
  		?>
  		<script language="javascript">
  		<!--
  		alert("Please provide necessary information");
  		//-->
  		</script>
  		<?
  		$shift="Add Record";
	} else {
		$result = mysql_query($verquery);
		$num = mysql_num_rows($result);
		if($num<=0){
  			$result = mysql_query($addquery); 
  			$shift="Add Record"; 
  		} else {
  			?>
  			<script language="javascript">
  			<!--
  			alert("Duplicate record is found.\n     Please try again.");
  			//-->
  			</script>
  			<?
  			$shift="Add Record";
  		}
	}
}	
$result = mysql_query ($sqlquery);
?>

<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" nowrap colspan="2" class="tdtitle">
    Examinee Codes</td>
  </tr>
<? if(!isset($printako)) ?>  
  <tr>
    <td align="center" nowrap class="tdgreen">Exam Code</td>
    <td align="center" nowrap class="tdgreen">&nbsp;</td>
  </tr>
  <tr>
<form name="addon" method="post" action="<?=$PHP_SELF?>">
<input type="hidden" name="origid" value="<?=$edeptid?>">
    <td align="center" nowrap class="tdblue">
    <? if(isset($disableme)){ 
    		?>
    <input type="hidden" name="tdeptid" size=2 value="<?=$edeptid?>">
    <b><?=$edeptid?></b>
    		<?
       } else { 
       		?>
    <input type="text" name="tdeptid" size=16 value="<?=$edeptid?>">
    <? } ?>
    </td>
    <td align="center" nowrap class="tdblue">
    <input type="submit" name="tsubmit" value="Add Code" class="btnblue"></td>
  </tr>
</form>
</table>
<p align="center">
<? $col = mysql_num_rows($result)/6;
$x=0;
while ($collection = mysql_fetch_object ($result)) {
$x++; ?>
    <?=$collection->EID?>&nbsp;&nbsp;-&nbsp;&nbsp;
<? } ?></p>


<?
mysql_free_result ($result);
?>
</center>
</div>
</body>
</html>
Return current item: E2Exam: LAMP for the Education