/* ========================================================================== Acesoftech Academy Contact Form Handler & Redirect Hook ========================================================================== */ function acesoftech_handle_contact_form_submission() { if ( isset( $_POST['contact_form_submit'] ) && ! empty( $_POST['contact_form_submit'] ) ) { $name = isset( $_POST['name'] ) ? sanitize_text_field( wp_unslash( $_POST['name'] ) ) : ''; $email = isset( $_POST['email'] ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : ''; $phone = isset( $_POST['phone'] ) ? sanitize_text_field( wp_unslash( $_POST['phone'] ) ) : ''; $course = isset( $_POST['course'] ) ? sanitize_text_field( wp_unslash( $_POST['course'] ) ) : ''; $message = isset( $_POST['message'] ) ? sanitize_textarea_field( wp_unslash( $_POST['message'] ) ) : ''; if ( ! empty( $name ) && ! empty( $phone ) ) { $admin_email = get_option( 'admin_email' ); $to = array( $admin_email, 'info@acesoftech.com', 'acesoftechacademy@gmail.com' ); $subject = "🔥 New Lead: " . $name . " interested in " . ( $course ? $course : 'IT Courses' ); $email_body = "
A new student has submitted the contact inquiry form.
| Student Name: | " . esc_html( $name ) . " |
| Phone / WhatsApp: | " . esc_html( $phone ) . " |
| Email Address: | " . esc_html( $email ) . " |
| Selected Course: | " . esc_html( $course ) . " |
| Message / Query: | " . nl2br( esc_html( $message ) ) . " |
| Submission Time: | " . current_time( 'F j, Y, g:i a' ) . " |