konstantinovgk

1.06 HTML TABLE

Jan 31st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Information Table</title>
  6. <style>
  7.     .infoTable{
  8.         width:320px;
  9.         font: 12px Arial;
  10.         border-collapse:collapse;
  11.     }      
  12.     .infoTable tbody th {
  13.         background-color:#9932CC;
  14.         color:#FFF;
  15.         border: 1px solid #888;    
  16.     }  
  17.     .infoTable tbody td {
  18.         border:1px solid #888;
  19.         text-align:right;
  20.     }      
  21. </style>   
  22. </head>
  23.  
  24. <body>
  25. <?php
  26.  
  27.  
  28. if(isset($_POST['submit']) && ($_POST['submit'] == 'Submit')){
  29.     $personalInfo['name'] =  htmlentities($_POST['name']);
  30.     $personalInfo['Phone_number'] = htmlentities($_POST['Phone_number']);
  31.     $personalInfo['age'] = htmlentities($_POST['age']);
  32.     $personalInfo['address'] = htmlentities($_POST['addrs']);
  33. ?>
  34. <table class="infoTable" description="This table contains personal info">
  35.     <tbody>
  36. <?php
  37. foreach($personalInfo as $key => $val){
  38. ?>
  39.         <tr>
  40.             <th scope="row" style="text-transform:capitalize"><?= $key ?></th>
  41.             <td><?= $val ?></td>  
  42.         </tr>      
  43. <?php
  44. }
  45. ?>        
  46.     </tbody>
  47. </table>
  48. <input type="button" value="Back" onClick="window.location = window.location;"/>
  49. <?php  
  50. } else {
  51. ?>
  52. <form id="form1" name="form1" method="post">
  53. <label for="name"> Name </label> - <input type="text" name="name" id="name"/> <br/>
  54. <label for="Phone_number"> Phone number</label> - <input type="text" name="Phone_number" id="Phone_number"/> <br/>
  55. <label for="age"> Age </label> - <input type="text" name="age" id="age"/> <br/>
  56. <label for="addrs"> Address </label> - <input type="text" name="addrs" id="addrs"/> <br/>
  57.   <input type="submit" name="submit" id="submit" value="Submit">
  58. </form>
  59. <?php
  60.  
  61. }
  62. ?>
  63. </body>
  64. </html>
Add Comment
Please, Sign In to add comment