Created
April 27, 2021 17:11
-
-
Save GurunadhPachappagari/bdb17a1b432f22ee16b358e04f8313f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| ID <?php echo $_POST["id"]; ?><br> | |
| Name <?php echo $_POST["name"]; ?><br> | |
| Address <?php echo $_POST["address"]; ?><br> | |
| Contact <?php echo $_POST["contact_number"]; ?><br> | |
| Gender <?php echo $_POST["gender"]; ?><br> | |
| <?php | |
| $PATIENTID=$_POST["id"]; | |
| $PATIENTNAME=$_POST["name"]; | |
| $PATIENTADDRESS=$_POST["address"]; | |
| $PATIENTCONTACT=$_POST["contact_number"]; | |
| $PATIENTGENDER=$_POST["gender"]; | |
| try { | |
| $username = "root"; | |
| $password = "guru"; | |
| $database = "hospital"; | |
| $table = "patient"; | |
| $mysqli = new mysqli("localhost", $username, $password, $database); | |
| $query = "call patient_enroll('$PATIENTID', '$PATIENTNAME', '$PATIENTADDRESS', '$PATIENTCONTACT', '$PATIENTGENDER')"; | |
| $result = $mysqli->query($query); | |
| } catch (mysqli_sql_exception $e) { | |
| print "Error!: " . $e->getMessage() . "<br/>"; | |
| die(); | |
| } | |
| ?> | |
| </body> | |
| </html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <h1>Hospital</h1> | |
| <form method="post"> | |
| <input type="submit" name="addPatient" | |
| class="button" value="add patient" /> | |
| <input type="submit" name="showPatient" | |
| class="button" value="show patient" /> | |
| </form> | |
| <?php | |
| echo '<body style="background-color:#383A59; color:white">'; | |
| if(array_key_exists('addPatient', $_POST)) { | |
| addPatient(); | |
| } | |
| else if(array_key_exists('showPatient', $_POST)) { | |
| showPatient(); | |
| } | |
| function addPatient() { | |
| echo '<form method="post" action="adding_data.php"> | |
| ID: <input type="text" name="id"><br> | |
| Name: <input type="text" name="name"><br> | |
| Address: <input type="text" name="address"><br> | |
| Contact: <input type="text" name="contact_number"><br> | |
| Gender: <input type="text" name="gender"><br> | |
| <input type="submit"> | |
| </form>'; | |
| } | |
| function showPatient() { | |
| try { | |
| $username = "root"; | |
| $password = "guru"; | |
| $database = "hospital"; | |
| $table = "patient"; | |
| $mysqli = new mysqli("localhost", $username, $password, $database); | |
| echo "<h2>PATIENT</h2><ol>"; | |
| $query = "SELECT * FROM patient"; | |
| $result = $mysqli->query($query); | |
| echo '<table border="1" cellspacing="2" cellpadding="2"> | |
| <tr> | |
| <td> <font face="Monospace">Name</font> </td> | |
| <td> <font face="Monospace">ID</font> </td> | |
| <td> <font face="Monospace">Address</font> </td> | |
| <td> <font face="Monospace">Contact Number</font> </td> | |
| <td> <font face="Monospace">Gender</font> </td> | |
| </tr>'; | |
| while ($row = $result->fetch_assoc()) { | |
| $field1name = $row["id"]; | |
| $field2name = $row["name"]; | |
| $field3name = $row["address"]; | |
| $field4name = $row["contact_number"]; | |
| $field5name = $row["gender"]; | |
| echo '<tr> | |
| <td> <font face="Monospace">'.$field1name.'</td> | |
| <td> <font face="Monospace">'.$field2name.'</td> | |
| <td> <font face="Monospace">'.$field3name.'</td> | |
| <td> <font face="Monospace">'.$field4name.'</td> | |
| <td> <font face="Monospace">'.$field5name.'</td> | |
| </tr>'; | |
| } | |
| $result->free(); | |
| echo "</ol>"; | |
| } catch (mysqli_sql_exception $e) { | |
| print "Error!: " . $e->getMessage() . "<br/>"; | |
| die(); | |
| } | |
| } | |
| ?> | |
| </body> | |
| </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment