Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/icure/admin/
Upload File :
Current File : /var/www/html/mmishra/icure/admin/phtests.inc

<h3 align='left'>Pathology Tests</h3>
<center>
<?php

$tbl = 'phtests';
$testid = $_REQUEST["testid"];
$testgroup = $_REQUEST["testgroup"];
if (!$testgroup) $testgroup = 'Haemetology';

if ($_POST["submit"] == 'SAVE') {
	
	$testname = $_POST["testname"];
	$testrange = $_POST["testrange"];

	if (mysql_num_rows(mysql_query("select * from $tbl where test_id=$testid"))) {
		mysql_query("update $tbl set test_group='$testgroup',test_name='$testname',test_range='$testrange',
		date_updation=now(),login_id='$user' where test_id=$testid");
	} else {
		mysql_query("insert into $tbl(test_group,test_name,test_range,date_creation,date_updation,login_id) 
		values('$testgroup','$testname','$testrange',now(),now(),'$user')");
	}

}

if ($_GET["del"] == 1) {
	mysql_query("delete from $tbl where test_id=$testid");
}

echo "Select group <b>";

foreach ($testgps as $tgp) {
	echo "<input type='radio' name='testgroup' value='$tgp'";
        if ($testgroup == $tgp) echo " checked";
        echo " onclick=\"document.location.href='?pg=$pg&testgroup='+this.value\"> $tgp";
}
echo "</b>

<table border='1' width='60%'>
<tr><th>Sr</th><th>Test Name</th><th>Value Range</th><td align='center'>Action</td></tr>";


if (!$testid) {
	echo "<tr><td>+</td>
	<td><input type='text' name='testname' value='' size='40'></td>
	<td><input type='text' name='testrange' value='' size='25'></td>
	<td><input type='submit' name='submit' value='SAVE'></td></tr>";     
} else {
	echo "<tr><td colspan='4'><a href='?pg=$pg&testgroup=$testgroup&testid='>+</a></td></tr>";
}

$rs = mysql_query("select * from $tbl where test_group='$testgroup' order by test_name");
while ($o = mysql_fetch_object($rs)) {
	$i++;
 	echo "<tr><td><a href='?pg=$pg&testgroup=$o->test_group&testid=$o->test_id'>$i</a></td>";
	if ($testid == $o->test_id) {
        	echo "<td><input type='hidden' name='testid' value='$o->test_id'>
		<input type='text' name='testname' value='$o->test_name' size='40'></td>
        	<td><input type='text' name='testrange' value='$o->test_range' size='25'></td>
        	<td nowrap><input type='submit' name='submit' value='SAVE'> 
		<a href='?pg=$pg&del=1&testgroup=$testgroup&testid=$o->test_id'>x</a></td>";     
	} else {
 		echo "<td>$o->test_name</td><td>$o->test_range</td>";	
	}
	echo "</tr>";
}

?>

</table>
</center>