Advertisement
Guest User

Untitled

a guest
Aug 16th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <?php
  2.  
  3. $dbhost = 'localhost';
  4.  
  5. $user = 'root';
  6.  
  7. $password = 'root';
  8.  
  9. $dbname = 'inventory';
  10.  
  11. $con = mysql_connect($dbhost, $user, $password);
  12.  
  13.  
  14. mysql_connect($dbname);
  15.  
  16.  
  17. ?>
  18. <html>
  19. <title>Add to Inventory</title>
  20. <head>
  21. </head>
  22. <body>
  23. <?php
  24. require_once "inventory.php";
  25.  
  26. if($_POST['action']='create"){
  27. include 'inventory.php';
  28. $sql = "INSERT INTO sedan ( year, make, model, color, price)
  29.  
  30. ('{$_POST['year']}','{$_POST['make']}', '{$_POST['model']}', '{$_POST['color']}', '{$_POST['price']}')";
  31.  
  32. if (mysql_query($sql){
  33. echo 'New record was saved.';
  34. } else{
  35. echo 'Error occurred';
  36. }
  37. ?>
  38.  
  39. <form method="post" action="#">
  40. <table>
  41. <TD>
  42. <tr>
  43. <p>Year: <input type="text" name="year"/></p></tr>
  44. Make: <select name="carmake">
  45. <option value="Acura">Acura</option>
  46. <option value="Audi">Audi</option>
  47. <option value="Ferrari">Ferrari</option>
  48. <option value="Infiniti">Infiniti</option>
  49. <option value="Lamborghini">Lamborghini</option>
  50. <option value="Maserati">Maserati</option>
  51. <option value="Tesla">Tesla</option>
  52. </select></p>
  53. Model: <input name="text" name="model"/>
  54. </p>
  55. Color: <select name="color">
  56. <option value="black">Midnight Black</option>
  57. <option value="blue">Clear Sky Blue</option>
  58. <option value="gray">Gunmetal Grey</option>
  59. <option value="white">Cloud White</option>
  60. <option value="yellow">Yellowjacket</option>
  61. </select></p>
  62. Price: <input type="text" name="price"/>
  63. </p>
  64. <input type="submit" value="Add to Inventory" name="submit"/>
  65. </form>
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement