Skip to content

Instantly share code, notes, and snippets.

@mr5z

mr5z/neil.php

Last active Mar 26, 2021
Embed
What would you like to do?
1k lang
<html>
<head>
<style>
#customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
</style>
</head>
<body>
<form method='GET' action='sample.php'>
<table>
<tr><td>Patient No.</td> <td><input type=text size=2 name=txtno></td></tr>
<tr><td>Name</td> <td><input type=text size=20 name=txtname></td></tr>
<tr><td>Address</td> <td><input type=text size=20 name=txtaddress></td></tr>
<tr><td>Contact Info</td><td> <input type=text size=10 name=txtcontact></td></tr>
<tr><td colspan=2 align=right> <input type=submit value="Save"></td></tr>
</table>
</form>
<?php
require_once("connect.php");
if (isset($_GET["txtno"])) {
$txtname = $_GET["txtname"];
$txtno = $_GET["txtno"];
$txtaddress = $_GET["txtaddress"];
$txtcontact = $_GET["txtcontact"];
$sql = "
INSERT INTO tblpatient(fldname,fldpatientinfo,fldaddress,fldcontact)
VALUES('$txtname','$txtno','$txtaddress','$txtcontact')";
$conn>query($sql);
}
if (isset($_GET["txtdelno"])) {
$txtdelno=$_GET["txtdelno"];
$sql="DELETE FROM tblpatient WHERE fldpatientno='txtdelno'";
$conn>query($sql);
}
$sql="SELECT ∗ FROM tblpatient";
$result = $conn>query($sql);
?>
<table border=1 width=500 id=customers>";
<tr>
<th></th><!-- Is this intentionally left blank? -->
<th>Patient No.</th>
<th>Name</th>
<th>Address</th>
<th>Contact Info</th>
</tr>
<?php while($row = $result->fetch_assoc()) { ?>
<tr>
<td>
<a href="sample.php?txtdelno=<?php echo $row['fldpatientno']; ?>">
<img src="delete.png" width=20 height=20 />
</a>
</td>
<td><?php echo $row["fldpatientno"]; ?></td>
<td><?php echo $row["fldname"]; ?></td>
<td><?php echo $row["fldaddress"]; ?></td>
<td><?php echo $row["fldcontact"]; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment