Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost = 'localhost';
- $user = 'root';
- $password = 'root';
- $dbname = 'inventory';
- $con = mysql_connect($dbhost, $user, $password);
- mysql_connect($dbname);
- ?>
- <html>
- <title>Add to Inventory</title>
- <head>
- </head>
- <body>
- <?php
- require_once "inventory.php";
- if($_POST['action']='create"){
- include 'inventory.php';
- $sql = "INSERT INTO sedan ( year, make, model, color, price)
- ('{$_POST['year']}','{$_POST['make']}', '{$_POST['model']}', '{$_POST['color']}', '{$_POST['price']}')";
- if (mysql_query($sql){
- echo 'New record was saved.';
- } else{
- echo 'Error occurred';
- }
- ?>
- <form method="post" action="#">
- <table>
- <TD>
- <tr>
- <p>Year: <input type="text" name="year"/></p></tr>
- Make: <select name="carmake">
- <option value="Acura">Acura</option>
- <option value="Audi">Audi</option>
- <option value="Ferrari">Ferrari</option>
- <option value="Infiniti">Infiniti</option>
- <option value="Lamborghini">Lamborghini</option>
- <option value="Maserati">Maserati</option>
- <option value="Tesla">Tesla</option>
- </select></p>
- Model: <input name="text" name="model"/>
- </p>
- Color: <select name="color">
- <option value="black">Midnight Black</option>
- <option value="blue">Clear Sky Blue</option>
- <option value="gray">Gunmetal Grey</option>
- <option value="white">Cloud White</option>
- <option value="yellow">Yellowjacket</option>
- </select></p>
- Price: <input type="text" name="price"/>
- </p>
- <input type="submit" value="Add to Inventory" name="submit"/>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement