My problem is this:
(1) on the back-end I have database in MySQL. It contains 7 tables. (2) On the front-end I have a HTML form. (3) The data entered from the user must populate these 7 tables. (4) I use PHP and link the form to database with mysqli.
For some reason the form populated only the first table and the other 6 received no data. Any idea how I can connect the form to all tables at once? I don’t want one sql table, because the HTML form has over 300 input fields. Thanks you.
edited
Here is the code
<?php
$host="localhost";
$user="root";
$pass="";
$db="ao db";
$conn = new mysqli ($host, $user, $pass, $db);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$firstname = $_POST["first_name"];
$lastname = $_POST["name"];
$female = $_POST["female"];
$stmt = $conn->prepare("INSERT INTO table_demo (Vorname, Nachname, female) VALUES (?, ?, ?)");
$stmt->bind_param("ssi", $firstname, $lastname, $female);
$stmt->execute();
$stmt->close();
echo "New records created in Demo";
$conn->close();
$link = new mysqli ($host, $user, $pass, $db);
if ($link->connect_error) {
die("Connection failed: " . $link->connect_error);
}
$height = $_POST["height"];
$weight = $_POST["weight"];
$stmt=$link->prepare("INSERT INTO table_pre (height, weight) VALUE (?, ?)");
$stmt->bind_param("ii", $height, $weight);
$stmt->execute();
$stmt->close();
echo "New records created in Pre";
$link->close();
>