Saturday, 19 August 2017

Insert query in php mysql with form post data

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";
}

No comments:

Post a Comment

Google Map Filter Api Example

Here is Google Map Filter Api Example: