A
Anonymous
Guest
Hello everyone,
I am new to this forum and also into php
I have a problem sending data from a html form to MariaDB using PHP. I have connection established and right now I am just able to see records ( id ) and not values I entered.
My html code is simple :
And after this I am using the php to send data to MariaDB, the records are not visible unfortunately :
You can see in the attachments the problem(test.png && db.png). I enter records and the I can not see them in phpmyadmin on the db.
I am using CentOS 7, PHP version: 7.2.34, nginx/1.21.3, and phpmyadmin 4.4.15.10, 5.5.68-MariaDB Server and database structure is the following ( attachments db.png)
Thank you in advance and sorry if someone posted already this topic.
Alex
I am new to this forum and also into php
I have a problem sending data from a html form to MariaDB using PHP. I have connection established and right now I am just able to see records ( id ) and not values I entered.
My html code is simple :
Code:
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
And after this I am using the php to send data to MariaDB, the records are not visible unfortunately :
Code:
<?php
$servername = "localhost";
$username = "root";
$password = "************";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO Form (name, email)
VALUES ('$_POST[post_name]', '$_POST[post_email]')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
You can see in the attachments the problem(test.png && db.png). I enter records and the I can not see them in phpmyadmin on the db.
I am using CentOS 7, PHP version: 7.2.34, nginx/1.21.3, and phpmyadmin 4.4.15.10, 5.5.68-MariaDB Server and database structure is the following ( attachments db.png)
Thank you in advance and sorry if someone posted already this topic.
Alex