Formularz nie zwraca mi wszystkich danych wpisanych do niego. Kombinuję i kombinuję, ale efektów to nie przynosi.
<?php } function ts_process_contact_form() { $headers = null; if (! wp_verify_nonce ( $_POST ['contact_nonce'], 'contact_form_submission' )) { $data ['status'] = 0; $err [] = "Invalid Form Submission"; } if ($_POST ['contact-form-value'] == 1) { $name = $field['Imię i nazwisko'] = filter_var($_POST['name'], FILTER_SANITIZE_STRING); $phone = $field['Telefon'] = filter_var($_POST['phone'], FILTER_SANITIZE_STRING); $email = $field['Email'] = filter_var($_POST['email'], FILTER_SANITIZE_STRING); $field['Message'] = filter_var($_POST['msg'], FILTER_SANITIZE_STRING); foreach ( $field as $k => $v ) { $err [] = $k . ' ' . __ ( 'is required', 'marine' ); } } if (! $field ['Email'] ) { $err [] = __ ( 'Email is invalid', 'marine' ); } // send the mail $to = ot_get_option ( 'contact_form_email' ); $headers = "From: $name <$email>" . "\r\n"; add_filter ( 'wp_mail_content_type', 'set_html_content_type' ); function set_html_content_type() { return 'text/html'; } $subject = ot_get_option ( 'contact_form_subject' ); $subject = __('Query', 'marine'); } $message_content = __('From:', 'marine').' '.$name."<br>"; $message_content = __('Telefon:', 'marine').' '.$phone."<br>"; $message_content .= __('Email:', 'marine').' <a href="mailto'.esc_attr($email).'">'.$email.'</a>'."<br>"; $message_content .= __('Message:', 'marine').' '.$field['Message']."\n"; if (wp_mail ( $to, $subject, $message_content, $headers )) { $data ['status'] = 1; $data ['message'] = __( 'Message Sent', 'marine' ); } else { $data ['status'] = 0; $data ['message'] = __( 'An Error occured.', 'marine' ); } remove_filter ( 'wp_mail_content_type', 'set_html_content_type' ); } else { $data ['status'] = 0; } } } add_action ( 'init', 'ts_process_contact_form' ); }
<form '.$style.' class="get-in-touch contact-form '. ts_get_animation_class($animation) . ' '.$skin_class.'" method="post"> '.wp_nonce_field( 'contact_form_submission', 'contact_nonce', true,false).' <input type="hidden" name="contact-form-value" value="1" id=""/> <div class="iconic-input"> <input type="text" name="name" placeholder="' . $name_label . '*"> </div> <div class="iconic-input"> <input type="text" phone="phone" placeholder="' . $phone_label . '"> </div> <div class="iconic-input"> <input type="text" name="email" placeholder="' . $email_label . '*"> </div> <input type="submit" value="' . $send_label . '"> <div class="iconic-button"> <input type="reset" value="' . $clear_label . '"> </div> </form>
Dane, które nie docierają to: telefon i treść wiadomości. Co tu poprawić, aby wszystko było OK?