File "contactcontroller.php"

Full Path: /home/u593703731/domains/anandinternationalschool.com/public_html/controller/contactcontroller.php
File size: 577 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
session_start();
include "../admin/includes/conn.php";

if (isset($_POST['submit'])) {

    $name    = $_POST['name'];
    $phone   = $_POST['phone'];
    $email   = $_POST['email'];
    $message = $_POST['message'];

    $query = "INSERT INTO `contacts` (`name`, `email`, `phone`, `message`) 
              VALUES ('$name','$email','$phone','$message')";

    $res = mysqli_query($conn, $query);

    if ($res) {
        $_SESSION['success'] = "Thanks for connecting with us!";
        header("Location: ../index.php");
        exit();
    }
}
?>