Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Week04 - Students</title>
  5. <link rel="stylesheet" type="text/css" href="bootstrap/dist/css/bootstrap.min.css"/>
  6. <link rel="stylesheet" type="text/css" href="datatables/media/css/dataTables.bootstrap.css"/>
  7. </head>
  8.  
  9. <?php
  10. $servername = "localhost";
  11. $username = "root";
  12. $password = "";
  13.  
  14. // Create connection
  15. $conn = new mysqli($servername, $username, $password);
  16.  
  17. // Check connection
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21. echo "Connected successfully";
  22. $sql = "INSERT INTO student ('NIM', 'NAMA DEPAN', 'NAMA BELAKANG')
  23. VALUES ('14110310025', 'Doe', 'John')";
  24.  
  25. if ($conn->query($sql) === TRUE) {
  26. echo "New record created successfully";
  27. } else {
  28. echo "Error: " . $sql . "<br>" . $conn->error;
  29. }
  30.  
  31. $conn->close();
  32. ?>
  33.  
  34. <body>
  35. <nav class="navbar navbar-default">
  36. <div class="container-fluid">
  37. <div class="navbar-header">
  38. <a class="navbar-brand" href="#">[IF635P] Web Programming - Students</a>
  39. </div>
  40. <ul class="nav navbar-nav pull-right">
  41. <li class="active"><a href='#'>Students</a></li>
  42. </ul>
  43. </div>
  44. </nav>
  45.  
  46. <div class="container">
  47. <?php
  48. if(isset($_GET['type'])) {
  49. $typeData = $_GET['type'];
  50.  
  51. if($typeData === 'pdo') {
  52.  
  53. }
  54. else if($typeData === 'mysqli') {
  55.  
  56. }
  57. }
  58. ?>
  59.  
  60. <div class="jumbotron">
  61. <form method='post' action='week04_1.php'>
  62. <div class="form-group">
  63. <label for='sid'>Student ID:</label>
  64. <input type="text" name="sid" class='form-control' id='sid' />
  65. </div>
  66.  
  67. <div class="form-group">
  68. <label for='firstName'>First Name:</label>
  69. <input class="form-control" name='fName' id='fName' type='text' />
  70. </div>
  71.  
  72. <div class="form-group">
  73. <label for='firstName'>Last Name:</label>
  74. <input class="form-control" name='lName' id='lName' type='text' />
  75. </div>
  76.  
  77. <button type='submit' class='btn btn-default'>Submit</button>
  78. </form>
  79. </div>
  80. </div>
  81.  
  82. <script type="text/javascript" href='jquery/dist/jquery.min.js'></script>
  83. <script type="text/javascript" href='bootstrap/dist/js/bootstrap.min.js'></script>
  84. </body>
  85. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement