0

THis is my html code i have checked multiple time but again its not working.

<form action="insert.php" method="POST">
        <input type="text" name="name"><br>
        <input type="text" name="fname"><br>
        <input type="submit" name=""><br>

    </form>

This is my php code i think code is correct but don't know its not working.

<?php
//include("php\DB.php");

$connection=new mysqli("localhost","root","","sms");
if($connection){
    echo "Connected";
}else{echo "Sorry";}



$username=$_POST["name"];
$fname=$_POST["fname"];



 $query="INSERT INTO student(name,fname)VALUES('".$username."','".$fname."')";



$connection->query($query);


?>

1 Answers1

0

according to my little knowledge please give space between insert statement

insert into student(name,fname) values('$username','$fname');
rch
  • 345
  • 1
  • 6
  • 20