Note that there are some explanatory texts on larger screens.

plurals
  1. POUnknown issue with my contact form in wordpress
    primarykey
    data
    text
    <p>I started working on a wordpress template and I am extremely stuck on this contact form, which I don't seem to find the problem. I must mention that I am somehow new to php, but I can understand pretty fast. This is what I am using for my contact page (there are also other elements but they do not interfere with the code I`m having trouble with):</p> <pre><code> &lt;?php get_header(); $two2_option = two2_get_global_options(); global $post; setup_postdata($post); ?&gt; &lt;?php if($two2_option['two2_contact_email']){ ?&gt; &lt;form method="post" id="ajax_form" action="#"&gt; &lt;fieldset&gt; &lt;ul class="form-item" id="field-name"&gt; &lt;li&gt; &lt;label&gt;&lt;?php _e("Name","jbirdie"); ?&gt;:&lt;span class="field-required" title="&lt;?php _e("Required Field","jbirdie"); ?&gt;"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input type="text" maxlength="90" name="name" id="name" placeholder="&lt;?php _e("name","jbirdie"); ?&gt;" size="30" class="form-field required text_input clear" /&gt; &lt;/li&gt; &lt;li&gt; &lt;label&gt;&lt;?php _e("E-mail","jbirdie"); ?&gt;:&lt;span class="field-required" title="&lt;?php _e("Required Field","jbirdie"); ?&gt;"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input type="email" maxlength="90" name="email" id="email" placeholder="&lt;?php _e("e-mail","jbirdie"); ?&gt;" size="30" class="form-field required email text_input clear" /&gt; &lt;/li&gt; &lt;li&gt; &lt;label&gt;&lt;?php _e("Phone","jbirdie"); ?&gt;&lt;/label&gt; &lt;input type="number" maxlength="90" name="phone" id="phone" placeholder="&lt;?php _e("phone number","jbirdie"); ?&gt;" size="30" class="form-field required email text_input clear" /&gt; &lt;/li&gt; &lt;li class="message"&gt; &lt;label&gt;&lt;?php _e("Comments","jbirdie"); ?&gt; &lt;span&gt;Available for quotation&lt;/span&gt;&lt;/label&gt; &lt;textarea cols="55" rows="" name="message" id="message" placeholder="&lt;?php _e("Comments","jbirdie"); ?&gt;" class="form-textarea text_area clear" &gt;&lt;/textarea&gt; &lt;/li&gt; &lt;/ul&gt; &lt;input type="submit" name="submit" id="submit" value="send" class="submit form-submit" /&gt; &lt;div id="result"&gt;&lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php get_footer(); ?&gt; </code></pre> <p><strong>and the following in functions.php :</strong></p> <pre><code>add_action('wp_ajax_nopriv_two2_send_contact_form', 'two2_send_contact_form'); add_action('wp_ajax_two2_send_contact_form', 'two2_send_contact_form'); function two2_send_contact_form(){ $two2_option = two2_get_global_options(); $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $subject = "Message from your portfolio"; $body = "From $name, \n\n$email, \n\n$phone, \n\n$message"; $to = $two2_option['two2_contact_email']; $result = mail($to, $subject, $body); if($result){ print "&lt;h3&gt;".__("Success","two2")."&lt;/h3&gt;&lt;p&gt;".__("Your email has been sent!","two2")."&lt;/p&gt;"; } else { print "&lt;h3&gt;".__("Error","two2")."&lt;/h3&gt;&lt;p&gt;".__("Try it again later, please.","two2")."&lt;/p&gt;"; } die(); } </code></pre> <p>...and it`s simply not working...can someone please give me a hint or sth to find the error?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload