I am very new to php , the experience is about a week in the backend and I hope they don’t throw tomatoes at me, but they will help.
The question is why the info is not added to the database when clicking on the form button? Like doing everything right.
Php code
if (isset($_POST["Submit"])) { $Dino_name = $_POST["Dinosaur_name"]; $Height = $_POST["Height"]; $Weight = $_POST["Weight"]; $Connection = mysqli_connect("localhost","root",""); //подключаемся к базе данных $Selected = mysqli_select_db($Connection,"new"); // выбираем из базы данных $Query = "INSERT INTO `dinosaurs`(`dinosaur_name`,`height`,`weight`) VALUES('$Dino_name','$Height','$Weight')"; $execute = mysqli_query($Query); } HTML form
<form action="simple.php"> <fieldset> Dinosaur:<br><input type="text" name="Dinosaur_name" value=""><br> Height:<br><input type="text" name="Height" value=""><br> Weight:<br><input type="text" name="Weight" value=""><br> <br><input type="Submit" name="Submit" value="Submit youre record"><br> </fieldset> </form> And a picture for clarity
formby defaultGETsends, add<form method="POST" action="simple.php"- Kosta B.