This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 17th, 2013  |  syntax: None  |  size: 1.56 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2. <head>
  3. <title>Add to Inventory</title>
  4. </head>
  5. <body>
  6. <?php
  7.         include 'inventory.php';
  8.                 if(isset ($_POST['submit']=="create")) {
  9.                         $stmt = $pdo->prepare("INSERT INTO `sedan`(`year`,`make`,`model`,`color`,`price`) VALUES(:year, :make, :model, :color, :price);");
  10.  
  11.                         $result = $stmt->execute(array(":year" => $_POST['year'],":make" => $_POST['make'],":model"=> $_POST['color'],":price"=> $_POST['price']));
  12.  
  13.                         if($result) {
  14.                                 echo 'New record was saved.';
  15.                         } else{
  16.                                 echo 'Error occurred';
  17.                         }
  18.                 ?>
  19.  
  20.  
  21.  
  22. <form method="post" action="#">
  23.  
  24. <p>Year: <input type="text" name="year"/></p>
  25. Make: <select name="make">
  26. <option value="Acura">Acura</option>
  27. <option value="Audi">Audi</option>
  28. <option value="Ferrari">Ferrari</option>
  29. <option value="Infiniti">Infiniti</option>
  30. <option value="Lamborghini">Lamborghini</option>
  31. <option value="Maserati">Maserati</option>
  32. <option value="Tesla">Tesla</option>
  33. </select></p>
  34. Model: <input name="text" name="model"/>
  35. </p>
  36. Color: <select name="color">
  37. <option value="black">Midnight Black</option>
  38. <option value="blue">Clear Sky Blue</option>
  39. <option value="gray">Gunmetal Grey</option>
  40. <option value="white">Cloud White</option>
  41. <option value="yellow">Yellowjacket</option>
  42. </select></p>
  43. Price: <input type="text" name="price"/>
  44. </p>
  45. <input type="submit" value="Add to Inventory" name="submit"/>
  46. </form>
  47. </body>
  48. </html>
clone this paste RAW Paste Data