<?php
function lapizzeria_save_reservation() {
if(isset($_POST[\'reservation\']) && $_POST[\'hidden\'] =="1") {
global $wpdb;
$sql = $wpdb->prepare("INSERT INTO reservation (name, date, email, phone, message)
VALUES (\'".$_POST["name"]."\',\'".$_POST["date"]."\',\'".$_POST["email"]."\',\'".$_POST["phone"]."\',\'".$_POST["message"]."\')");
$wpdb->query($sql);
$name =$_POST[\'name\'];
$date =$_POST[\'date\'];
$email =$_POST[\'email\'];
$phone =$_POST[\'phone\'];
$message =$_POST[\'message\'];
function insertuser( $name, $date, $email, $phone, $message){
global $wpdb;
$wpdb = $wpdb->prefix . \'reservations\';
$name = $_POST[\'name\'];
$date = $_POST[\'date\'];
$email = $_POST[\'email\'];
$phone = $_POST[\'phone\'];
$message = $_POST[\'message\'];
$format = array(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\');
$success = $wpdb->insert($reservations, array(\'name\' => $name, \'date\' => $date, \'email\'=> $email, \'phone\'=>$phone, \'message\'=>$message ));
}
if($success) {
echo \'Inserted successfully\';
} else {
echo \'not\';
}
}
add_action(\'init\', \'lapizzeria_save_reservation\');
?>