Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Information Table</title>
- <style>
- .infoTable{
- width:320px;
- font: 12px Arial;
- border-collapse:collapse;
- }
- .infoTable tbody th {
- background-color:#9932CC;
- color:#FFF;
- border: 1px solid #888;
- }
- .infoTable tbody td {
- border:1px solid #888;
- text-align:right;
- }
- </style>
- </head>
- <body>
- <?php
- if(isset($_POST['submit']) && ($_POST['submit'] == 'Submit')){
- $personalInfo['name'] = htmlentities($_POST['name']);
- $personalInfo['Phone_number'] = htmlentities($_POST['Phone_number']);
- $personalInfo['age'] = htmlentities($_POST['age']);
- $personalInfo['address'] = htmlentities($_POST['addrs']);
- ?>
- <table class="infoTable" description="This table contains personal info">
- <tbody>
- <?php
- foreach($personalInfo as $key => $val){
- ?>
- <tr>
- <th scope="row" style="text-transform:capitalize"><?= $key ?></th>
- <td><?= $val ?></td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <input type="button" value="Back" onClick="window.location = window.location;"/>
- <?php
- } else {
- ?>
- <form id="form1" name="form1" method="post">
- <label for="name"> Name </label> - <input type="text" name="name" id="name"/> <br/>
- <label for="Phone_number"> Phone number</label> - <input type="text" name="Phone_number" id="Phone_number"/> <br/>
- <label for="age"> Age </label> - <input type="text" name="age" id="age"/> <br/>
- <label for="addrs"> Address </label> - <input type="text" name="addrs" id="addrs"/> <br/>
- <input type="submit" name="submit" id="submit" value="Submit">
- </form>
- <?php
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment