note 119238 deleted from reserved.variables.post by cmb

From: Date: Mon, 25 Apr 2016 15:18:23 +0000
Subject: note 119238 deleted from reserved.variables.post by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-205326@lists.php.net to get a copy of this message
Note Submitter: cowsutters2 at hotmail dot com ---- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Add a Movie</title> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <?php require_once('connectvars.php'); if(isset($_POST['submit'])){ $link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $Title=($_POST['title']); $Price=($_POST['price']); $Author=($_POST['author']); $Quantity=($_POST['qty']); // THIS MUST MATCH THE ID TAG IN FORMS $query = "INSERT INTO BookStore VALUES ('0', '$Title', '$Price', '$Author', '$Quantity')"; echo $query; $result = mysqli_query($link, $query); if($result){ echo "Successful"; { else { echo "went wrong"; } ?> <h2> Eter a book that oyu wish to add to the data base </h2> <h3>Programm by Spencer Lamoure</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <label for="title">Title</label> <input type="text" id="title" name="title" /><br /> <label for="price">Price</label> <input type="number" id="price" name="price" /><br /> <label for="author">Author</label> <input type="text" id="author" name="author" /><br /> <label for="qty">Quantity</label> <input type="text" id="qty" name="qty" /><br /> <input type="submit" value="Submit Book" name="submit" /> </form> </body> </html> <?php //if(mysqli_num_rows($Result) > 0){ // echo "continue"; //} require_once('connectvars.php'); $link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query = "Create table BookStore ( id INT UNSIGNED PRIMARY KEY, AUTO_INCREMENT NOT NULL, title varchar(50), price decimal(5,2), author varchar(50), qty int UNSIGNED )"; $result = mysqli_query($link, $query); if ($result == true) { echo "The query was successfully executed!<br />"; } else { echo "The query could not be executed!" . mysqli_error($link); } mysqli_close($link); ?>

« previous php.notes (#205326) next »