insertform.php
<!doctype html><html>
<head>
<meta charset="utf-8">
<title>insert user</title>
</head>
<body>
<h1>insert form</h1>
<form name="insert" action="insert_db.php" method="post">
<label id="username">username</label>
<input type="text" name="username" id="username"><br>
<label id="password">password</label>
<input type="password" name="password" id="password"><br>
<label id="name">name</label>
<input type="text" name="name" id="name"><br>
<label id="lastname">lastname</label>
<input type="text" name="lastname" id="lastname"><br>
<label id="mobile">mobile</label>
<input type="text" name="mobile" id="mobile"><br>
<label id="email">email</label>
<input type="text" name="email" id="email"><br>
<label id="address">address</label>
<textarea name="address" id="address" cols="50" rows="10"></textarea><br>
<input type="submit" name="btn_submit" id="btn_submit" value="save!!">
</form>
</body>
</html>
insert_db.php
<?php//echo "<pre>",print_r($_POST, true),"</pre>";
include "connect.php";
$data = array(
"username"=>$_POST["username"],
"password"=>$_POST["password"],
"name"=>$_POST["name"],
"lastname"=>$_POST["lastname"],
"mobile"=>$_POST["mobile"],
"email"=>$_POST["email"],
"address"=>$_POST["address"]
);
$sql="insert into tb_user (username,password,name,lastname,mobile,email,address) VALUES (?,?,?,?,?,?,?)";
$qr=$con->prepare($sql);
if($qr === false){
trigger_error("wrong sql :".$sql."error :".$con->error,E_USER_ERROR);}
$qr->bind_param("sssssss",$data["username"],$data["password"],$data["name"],$data["lastname"],$data["mobile"],$data["email"],$data["address"]);
$qr->execute();
echo "insert to db",$qr->affected_rows,"row";
$qr->close();
?>