Customer Details Form


/** * Template Name: Function Hall Booking Step 3 */ get_header(); if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’ && isset($_POST[‘step_3_submit’])) { // Store customer details and create the booking. $customer_name = sanitize_text_field($_POST[‘customer_name’]); $contact_number = sanitize_text_field($_POST[‘contact_number’]); $email = sanitize_email($_POST[’email’]); $address = sanitize_textarea_field($_POST[‘address’]); $function_for = sanitize_text_field($_POST[‘function_for’]); // Create a new function hall booking post $booking_post = array( ‘post_title’ => ‘Booking on ‘ . $_SESSION[‘event_date’], ‘post_content’ => ‘Booking details…’, ‘post_status’ => ‘publish’, ‘post_type’ => ‘function_hall_booking’, ); $booking_id = wp_insert_post($booking_post); if ($booking_id) { update_post_meta($booking_id, ‘event_date’, $_SESSION[‘event_date’]); update_post_meta($booking_id, ‘slot’, $_SESSION[‘slot’]); update_post_meta($booking_id, ‘max_pax’, $_SESSION[‘max_pax’]); update_post_meta($booking_id, ‘food_items’, $_SESSION[‘food_items’]); update_post_meta($booking_id, ‘customer_name’, $customer_name); update_post_meta($booking_id, ‘contact_number’, $contact_number); update_post_meta($booking_id, ’email’, $email); update_post_meta($booking_id, ‘address’, $address); update_post_meta($booking_id, ‘function_for’, $function_for); // Redirect to a confirmation page or show a success message wp_redirect(add_query_arg(‘step’, 4, get_permalink())); exit; } } ?>

Function Hall Booking – Step 3