Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2.     if($_SERVER['REQUEST_METHOD']=='POST') {
  3.    
  4.         $dbinfo = 'mysql:host=localhost;dbname=db';
  5.         $user = 'root';
  6.         $pass = 'root';
  7.         $link = new PDO($dbinfo, $user, $pass);
  8.  
  9.         //Create ane execute a MySQL query
  10.         $sql = "SELECT *
  11.                FROM seats"
  12.         $stmt = $link->prepare($sql);
  13.         if($stmt->execute(array($_POST['name']))){
  14.             while($row = $stmt->fetch()) {
  15.                 printf($row['name']);
  16.             }
  17.             $stmt->closeCursor();
  18.         }
  19.    
  20.     }    
  21.  
  22. ?>
  23. <!doctype html>  
  24. <head>
  25.   <meta charset="utf-8">
  26.   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  27.  
  28.   <title>Seating Booking</title>
  29.   <meta name="description" content="testing roar">
  30.   <meta name="author" content="Garrett Heinlen">
  31.   <link href="less/style.css" rel="stylesheet" />
  32.    
  33. </head>
  34. <body>
  35.  
  36. <form action="page2.php" method="post">
  37.     <input type="text" name="name" value="name" />
  38.     <input type="submit" name="submit" value="submit" />
  39. </form>
  40.  
  41.  
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement