Your IP : 216.73.216.40


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

<h3 align='left'>Attached Hospitals</h3>
<center>
<?php

$tbl = 'hospitals';
$hosid = $_REQUEST["hosid"];

if ($_POST["submit"] == 'SAVE') {
	
	$hosname = $_POST["hosname"];
	$contact = $_POST["contact"];
	$address = $_POST["address"];

	if (mysql_num_rows(mysql_query("select * from $tbl where hos_id=$hosid"))) {
		mysql_query("update $tbl set hos_name='$hosname',contact='$contact',address='$address',
		login_id='$user' where hos_id=$hosid");
	} else {
		mysql_query("insert into $tbl(hos_name,contact,address,login_id) 
		values('$hosname','$contact','$address','$user')");
	}

}

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

?>

<table border='1' width='80%'>
<tr><th>Sr</th><th>Hospital Name</th><th>Contact</th><th>Address</th><td align='center'>Action</td></tr>

<?php

if (!$hosid) {
	echo "<tr><td>+</td>
	<td><input type='text' name='hosname' value='' size='40'></td>
	<td><input type='text' name='contact' value='' size='25'></td>
	<td><input type='text' name='address' value='' size='40'></td>
	<td><input type='submit' name='submit' value='SAVE'></td></tr>";     
} else {
	echo "<tr><td colspan='5'><a href='?pg=$pg&hosid='>+</a></td></tr>";
}

$rs = mysql_query("select * from $tbl order by hos_name");
while ($o = mysql_fetch_object($rs)) {
	$i++;
 	echo "<tr><td><a href='?pg=$pg&hosid=$o->hos_id'>$i</a></td>";
	if ($hosid == $o->hos_id) {
        	echo "<td><input type='hidden' name='hosid' value='$o->hos_id'>
		<input type='text' name='hosname' value='$o->hos_name' size='40'></td>
        	<td><input type='text' name='contact' value='$o->contact' size='25'></td>
        	<td><input type='text' name='address' value='$o->address' size='40'></td>
        	<td nowrap><input type='submit' name='submit' value='SAVE'> 
		<a href='?pg=$pg&del=1&hosid=$o->hos_id'>x</a></td>";     
	} else {
 		echo "<td><a href='?pg=$pg&hosid=$o->hos_id'>$o->hos_name</a></td>
		<td>$o->contact</td><td>$o->address</td>";	
	}
	echo "</tr>";
}

?>

</table>
</center>