Config.php <?php Class Config{ public function db_connect(){ $servername = "127.0.0.1"; $username = "root"; $password = ""; $dbname = "sampledb"; // Create connectionppamsdbadmin2022 $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: ERROR 0001" . $conn->connect_error); } return $conn; } public function addUser($id, $fName, $mName, $lName){ $db=$this->db_connect(); $sql= "INSERT INTO tbl_profile(id, fName, mName, lName) VALUES('$id','$fName','$mName','$lName')"; $result = $db->query($sql); $errno=mysqli_errno($db); $err=mysqli_error($db); if($result){ //return 'User has been registered successfully.'; return true; }else{ return $err;} } } Save.php <html> <head> <title> sample lang </title> </head> Click to<a href="index.php">HOME</a> &nbsp &nbsp <a href="delete.php">DELETE</a><br> <body> <?php require_once('Config.php'); $db=new Config(); $id=$_POST['id']; $fName=$_POST['f_name']; $mName=$_POST['m_name']; $lName=$_POST['l_name']; $isSave = $db->addUser($id, $fName, $mName, $lName); if($isSave){ Echo 'You have been registered'; }else{ echo $isSave; } ?> </body> </html> Index.php <html> <head> <title> Sample lang po </title> </head> <body> <a href="edit.php">Edit account<a> &nbsp &nbsp <a href="delete.php">Delete acount<a>&nbsp &nbsp <form method="post" action="save.php"> &nbsp &nbsp <center> <input type="hidden" name="id" value=""><br> Enter your first name:&nbsp &nbsp<input type="text" name="f_name" value=""><br> Enter your middle name:&nbsp &nbsp<input type="text" name="m_name" value=""><br> Enter your last name:&nbsp &nbsp<input type="text" name="l_name" value=""><br> <input type="submit" name="submit" value="save"><br> </center> </form> </body> </html>