note 119242 added to reserved.variables.post
| From: | cowsutters2 at hotmail dot com | Date: | Mon, 25 Apr 2016 17:38:31 +0000 |
| Subject: | note 119242 added to reserved.variables.post | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205329@lists.php.net to get a copy of this message | ||
<!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>
<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);
?>
----
Server IP: 72.52.91.14
Probable Submitter: 108.170.176.143
----
Manual Page -- http://php.net/manual/en/reserved.variables.post.php
Edit -- https://master.php.net/note/edit/119242
Del: integrated -- https://master.php.net/note/delete/119242/integrated
Del: useless -- https://master.php.net/note/delete/119242/useless
Del: bad code -- https://master.php.net/note/delete/119242/bad+code
Del: spam -- https://master.php.net/note/delete/119242/spam
Del: non-english -- https://master.php.net/note/delete/119242/non-english
Del: in docs -- https://master.php.net/note/delete/119242/in+docs
Del: other reasons-- https://master.php.net/note/delete/119242
Reject -- https://master.php.net/note/reject/119242
Search -- https://master.php.net/manage/user-notes.php