Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = mysqli_connect("localhost", "root", "root", "c9") or die("QUERY failed". mysqli_error($db));
- if (isset($_POST['submit'])) {
- $student = $_POST['first'];
- $last = $_POST['password'];
- $phone = $_POST['phonenumber'];
- $email = $_POST['email'];
- $location = $_POST['location'];
- $query = "INSERT INTO booking(first, Last, Phone, email,location) VALUES('$student', '$last', '$phone', '$email', '$location' )";
- $results = mysqli_query($db, $query);
- //if !$run_query is true then echo this error.
- if($results) {
- //echo that it worked
- echo 'QUERY ok<br />';
- } else {
- //if it fails then do this.
- echo 'QUERY failed -- ' . mysqli_error($db) . '<br />';
- }
- }
- ?>
- <?php
- session_start();
- if($_SESSION['login'] != "That GRRRRREAT")
- {
- header('Location: login.php');
- exit();
- }
- ?>
- <html>
- <head> <link rel="stylesheet" a href="book.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3..3.1/jquery"></script></head>
- <body>
- <ul>
- <li style="float:right" ><a href="FAQ.html">FAQ</a></li>
- <li><a href="profilepage.php">profile </a></li>
- <li><a href="messages.php">Messages</a></li>
- <li ><a href="booking.php">booking </a></li>
- </ul>
- <div id= "container">
- <div id="form">
- <form action="book.php" method="post">
- <table>
- <tr>
- <td align= "right">
- First Name:
- </td>
- <td>
- <input size="20px" size="20px" maxlengh="15" type="text" name="first" id="user" onkeyup="check_user()" required>
- </td>
- </tr>
- <tr>
- <td align = "right">
- Last Name:
- </td>
- <td>
- <input size="20px" type="textf" size="20px" maxlengh="15" name="password">
- </td>
- <td align= "right">
- Email:
- </td>
- <td>
- <input size="20px" size="20px" maxlengh="15" type="text" name="email" id="user" onkeyup="check_user()" required>
- </td>
- </tr>
- <tr>
- <td align = "right">
- Phone number:
- </td>
- <td>
- <input size="20px" type="text" size="20px" maxlengh="15" name="phonenumber">
- </td>
- </tr>
- <tr>
- <td align = "right">
- Location:
- </td>
- <td>
- <input size="20px" type="textf" size="20px" maxlengh="15" name="location">
- </td>
- </tr>
- <td colspan= "2" align="left"> <button type="submit" class="button" name="submit">Add the task</button></td>
- </div>
- <table>
- <thead>
- <tr>
- <th> </th>
- <th class="taskz">Tasks</th>
- <th>Done</th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
- <?php
- $db = mysqli_connect("localhost", "root", "root", "todo") or die("QUERY failed". mysqli_error($db));
- $run_task = mysqli_query($db, "SELECT * FROM booking LIMT 20");
- if ($run_task)
- {
- while ($row = mysql_fetch_assoc($run_task))
- {
- $id = $row['id'];
- $task1 = $row['First'];
- ?>
- <tr>
- <td>?php echo $id; ?> </td>
- <td>?php echo $task1; ?> </td>
- <td class = "delete"> <a href="index.php?delete=<?php echo $id;?>"> X</a></td>
- </tr>
- <?php } }?>
- </tbody>
- </table>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement