I have this PHP script to insert data in my MySQL Database:
<?php
$servername = "..."; // Host name
$username = "..."; // Mysql username
$password = "..."; // Mysql password
$dbname = "..."; // Database name
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$barcode = $_POST['barcode'];
$name = $_POST['name'];
$kategorie = $_POST['kategorie'];
$preis = $_POST['preis'];
$b1 = addslashes($_POST['b1']);
$b1_1 = addslashes($_POST['b1_1']);
$sql = "INSERT INTO produkte (barcode,name,kategorie,preis,b1,b1_1) VALUES ('$barcode', '$name', '$kategorie', '$preis', '$b1', '$b1_1')";
if ($conn->multi_query($sql) === TRUE) {
echo "New records created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
The form :
<html>
<head>
<meta charset="utf-8">
<title>Produkt hinzufügen</title>
</head>
<body>
<form action="eintragen.php" action="POST"/>
Barcode: <input type="text" name="barcode"/><br/>
Name: <input type="text" name="name"/><br/>
Kategorie: <input type="text" name="kategorie"/><br/>
Preis:<input type="text" name="preis"/><br/>
Beschreibungstext 1: <input type="text" name="b1" /><br/>
Beschreibungstext 1.1: <input type="text" name="b1_1"/><br/>
<input type="submit" value="Absenden"/>
</form>
</body>
</html>
When I insert all the data in the html file and submit it, the PHP Script tells me that new records were created successfully.
But it only creates a new row with no data inside...
Would be nice if you could help me...
Cheers, Till
Name:
Kategorie:
Preis:
Beschreibungstext 1:
Beschreibungstext 1.1:
– till36 Jul 19 '17 at 10:01