Guest User

Untitled

a guest
Sep 7th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. div.container {
  6. width: 50%;
  7. border: 1px solid gray;
  8. border-radius: 25px;
  9. }
  10.  
  11. header{
  12. border-radius: 15px 15px 0px 0px;
  13. padding: 1em;
  14. color: white;
  15. background-color: black;
  16. clear: left;
  17. text-align: center;
  18. }
  19. footer {
  20. border-radius: 0px 0px 15px 15px;
  21. padding: 1em;
  22. color: white;
  23. background-color: black;
  24. clear: left;
  25. text-align: center;
  26. }
  27.  
  28. th {
  29. display: table-cell;
  30. vertical-align: inherit;
  31. font-weight: bold;
  32. text-align: center;
  33. }
  34. nav {
  35. float: left;
  36. width: 80px;
  37. padding: 1em;
  38. }
  39.  
  40. nav ul {
  41. list-style-type: none;
  42. padding: 0;
  43. }
  44.  
  45. nav ul a {
  46. text-decoration: none;
  47. }
  48.  
  49. article {
  50. border-left: 1px solid gray;
  51.  
  52. padding: 1em;
  53. overflow: hidden;
  54. }
  55. </style>
  56. </head>
  57. <body>
  58.  
  59. <div class="container">
  60.  
  61. <header>
  62. <h1>Insurance</h1>
  63. </header>
  64.  
  65. <!DOCTYPE html>
  66. <html>
  67. <body>
  68.  
  69.  
  70. <body>
  71. <form action="insertion.php" method="POST">
  72.  
  73.  
  74.  
  75. <table style="width:100%">
  76. <tr>
  77. <th><h1>Agent</h1></th>
  78. </tr>
  79.  
  80.  
  81.  
  82. <tr>
  83. <td colspan="1"><label for="i1" class="col-lg-2 control-label">First Name</label></td>
  84. <td><input id="i1" type="text" name="fname" required></td>
  85. </tr>
  86. <tr>
  87. <td colspan="1"><label for="i2" class="col-lg-2 control-label">Last name</label></td>
  88. <td><input id="i2" type="text" name="lname" required></td>
  89. </tr>
  90. <tr>
  91. <td colspan="1"> <label for="i3" class="col-lg-2 control-label">Agent Id</label></td>
  92. <td><input id="i3" type="text" name="aid" required></td>
  93. </tr>
  94. <tr>
  95. <td colspan="1"> <label for="i4" class="col-lg-2 control-label">User name</label></td>
  96. <td> <input id="i4" type="text" name= "uname" required></td>
  97. </tr>
  98. <td colspan="1"> <label for="i4" class="col-lg-2 control-label">Phone</label></td>
  99. <td> <input id="i4" type="text" name= "phone" required></td>
  100. </tr>
  101.  
  102.  
  103. <td></td><td>
  104. <input type="submit" value="submit"></td>
  105. </tr>
  106. </table>
  107.  
  108. <br>
  109.  
  110. </br>
  111.  
  112.  
  113. <script>
  114. </script>
  115.  
  116. <?php
  117.  
  118. $fname=filter_input(INPUT_POST,'fname');
  119. $lname=filter_input(INPUT_POST,'lname');
  120. $aid=filter_input(INPUT_POST,'aid');
  121. $uname=filter_input(INPUT_POST,'uname');
  122. $phone=filter_input(INPUT_POST,'phone');
  123.  
  124.  
  125.  
  126. if (!empty($fname) || !empty(lname) || !empty($aid) || !empty($uname) || !empty($phone))
  127. {
  128. $host = "localhost";
  129. $dbusername="root";
  130. $dbpassword="";
  131. $dbname = "insurance";
  132.  
  133. $conn = new mysqli ($host,$dbusername,$dbpassword,$dbname);
  134.  
  135. if (mysqli_connect_error()){
  136. die('Connect Error ('. mysqli_connect_errno() .') '
  137. . mysqli_connect_error());
  138. }
  139. else{
  140. $sql = "INSERT INTO Agent (First_name, Last_name, Agent_id, User_name, Phone)
  141. values ('$fname', '$lname', '$aid', '$uname', '$phone')";
  142. if ($conn->query($sql)){
  143. echo "new record is inserted sucessfully";
  144. }
  145. else{
  146. echo "Error: ". $sql ."<br>". $conn->error;
  147. }
  148.  
  149. }
  150. }
  151.  
  152. ?>
  153. <?php
  154.  
  155. $host = "localhost";
  156. $dbusername="root";
  157. $dbpassword="";
  158. $dbname = "insurance";
  159.  
  160. $conn = new mysqli ($host,$dbusername,$dbpassword,$dbname);
  161.  
  162.  
  163. ?>
  164.  
  165.  
  166.  
  167.  
  168. </div>
  169.  
  170. </body>
  171.  
  172. <footer>Copyright &copy; fintech.gitam.edu</footer>
  173. </html>
Add Comment
Please, Sign In to add comment