0

I am trying to insert data in to my database using html forms. But it is giving me an error as:

Notice: Undefined index: name in C:\wamp64\www\testtable\test-table.php on line 7

I am using Wampserver for localhost

Here is my html spec-table-data.html

<html>
<head><title>Student's Data</title></head>
<body>
<form action="test-table.php" method="post">
    Name:<input type="text" name="name"><br>
    Adress:<input type="text" name="address"><br>

    <input type="submit" name="submit">
</form>
</body>

</html>

my php - test-table.php

<?php

$con = mysqli_connect("localhost","root","");

mysqli_select_db($con, "testtable");

$Names = $_POST['name'];
$Adresses = $_POST['address'];

$sqltables = "INSERT INTO testtable (Name,Adress) VALUES ('$Names', '$Adresses')";

mysqli_query($con, $sqltables);

mysqli_close($con);
goto
  • 7,908
  • 10
  • 48
  • 58
Sibi Kasim
  • 41
  • 1
  • 1
  • 4

0 Answers0