Here is the code for Insert query in php mysql with form post data:
$name = $_POST["cname"];
$phone = $_POST["cphone"];
$email = $_POST["cemail"];
$con = mysqli_connect("localhost", "root", "", "oops");
$sql = "INSERT INTO `user`(`name`, `phone`, `email`) VALUES ('$name', '$phone', '$email')";
$result = mysqli_query($con, $sql);
if($result) {
echo "user added";
} else {
echo "user did not add";
}
$name = $_POST["cname"];
$phone = $_POST["cphone"];
$email = $_POST["cemail"];
$con = mysqli_connect("localhost", "root", "", "oops");
$sql = "INSERT INTO `user`(`name`, `phone`, `email`) VALUES ('$name', '$phone', '$email')";
$result = mysqli_query($con, $sql);
if($result) {
echo "user added";
} else {
echo "user did not add";
}
No comments:
Post a Comment