Skip to content

Instantly share code, notes, and snippets.

function handleComments() {
global $conn;
$success = false;
$err = "";
if(isset($_POST["send"])) {
//echo "you have pressed submit </br>";
if (!empty($_POST["fullname"])) {
$fn = sanitize_input($_POST["fullname"]);
//echo "You have entered your name. </br>";
$query = "INSERT INTO feedback (name, email, comment) VALUES ('$fn', '$em', '$comm')";
if (mysqli_query($conn, $query)) {
echo "New record created successfully";
} else {
echo "Error: " . $query . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
$sql = "INSERT INTO feedback (name, email, comment) VALUES ('$fn', '$em', '$comm')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$query = "INSERT INTO tableName VALUES (DEFAULT,'$fullname', '$email', '$comment')";
or:
$query = "INSERT INTO tableName (fullname, email, comment) VALUES ('$fullname', '$email', '$comment')";
@mcorkum
mcorkum / cu-gallery.php
Last active February 18, 2016 15:01
Plugin Script Enqueue