Контактная форма не работает из-за постоянных ссылок

Я работаю над wordpress и пытаюсь отправить форму. Он не отправляется, я думаю, из-за постоянных ссылок, пожалуйста, смотрите мой код ниже:

<?php
/*
Template Name: Contact 
*/
get_header();
get_template_part('/functions/page-title'); 
?>

<style>

textarea, input[type="text"] {
    width: 60%;
    max-width: 500px;
    box-sizing: border-box;
    height: 40px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
}
</style>

<link href="style.css" rel="stylesheet" type="text/css" />
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"])) {
    echo("not postttttttttt");
    echo(var_dump($_POST));
  ?>
<form method="post" >
  <div id="content" align="center">
  <div id="left-column">
    <div>
      <div class="page-title-block">
        <h3 class="page-title"><a href="<?php the_permalink(); ?>"></a></h3>
      </div>
      <div align="center" class="copy clearfix">
        <?php the_content(); ?>
        <div align="center" style="position:relative;  width900px; background-color:#454545; margin-top:20px; height:630px; ">
          <div style="position:absolute; left:33px; top:30px; color:#fff; font-size:14px; ">All fields are required.</div>
          <div style="position:absolute; left:34px; top:70px; color:#fff; font-weight:bold; font-size:15px; ">Full Name</div>
          <textarea name="fullname" style="position:absolute; top:90px; left:30px;  text-align:left;"></textarea>
          <div style="position:absolute; left:34px; top:130px; color:#fff; font-weight:bold; font-size:15px; ">Phone Number</div>
          <textarea name="phonenumber" style="position:absolute; top:150px; left:30px; text-align:left;"></textarea>
          <div style="position:absolute; left:34px; top:190px; color:#fff; font-weight:bold; font-size:15px; ">Email Address</div           >
          <textarea name="emailaddress" style="position:absolute; top:210px; left:30px; text-align:left;"></textarea>
          <div style="position:absolute; left:34px; top:250px; color:#fff; font-weight:bold; font-size:15px; ">Subject</div>
          <div class="cleanf twi_disp" style="position:absolute; top:270px; left:30px; width:358px; height:44px; text-align:left; background:url(images/field_358_44.png); ">
            <div id="fild1ov" style="position:absolute; font-size:16px; font-family:Arial, Helvetica, sans-serif; color:#666; left:10px; top:16px; ">
              <select name="subject">
                <option value="Select">Select</option>
                <option value="technical">Technical issue</option>
                <option value="commercial">Commercial issue</option>
              </select>
            </div>
          </div>
          <div style="position:absolute; left:34px; top:340px; color:#fff; font-weight:bold; font-size:15px; ">Description</div>
          <div class="msg" style="position:absolute; top:360px; left:30px; text-align:left; background:url(images/field_760_162.png); ">
            <textarea name="message" style="top:5px; left:4px; position:absolute;" class="msg"></textarea>
          </div>
          <input type="submit" value="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
          <div style="position:absolute; left:30px; top:560px; color:#fff; font-size:14px; ">Please check your spam/junk folder if you do not receive a reply within the next 24 hours.</div>
        </div>
      </div>
    </div>
  </div>
</form>
<?php
} else {    // the user has submitted the form
  // Check if the "fullname" input field is filled out
    echo('qqqqqqqqqqqqqqqqq');
  if (isset($_POST["fullname"])) {  
    echo('sssssssssssssss');
    $fullname = $_POST["fullname"];
    $phonenumber = $_POST["phonenumber"]; // sender
    $subject = $_POST["subject"];
    $message = $_POST["message"];
    // message lines should not exceed 70 characters (PHP rule), so wrap it
    $message = wordwrap($message, 70);
    $to = "[email protected]";

 wp_mail( $to, $subject, $message, $headers, $attachments ); 
  }
}
?>
<?php get_footer(); ?>

при нажатии кнопки отправки код не вводит фрагмент php, куда он должен отправить электронное письмо, зная, что я могу отправить электронное письмо, когда я помещаю почтовый код в начало своей страницы. Плюс, когда я добавляю echo(var_dump($_POST)); значения заполняются правильно.


person mkazma    schedule 31.05.2014    source источник
comment
просто для ясности, при отправке формы отображается эта часть: echo('qqqqqqqqqqqqqqqqq');, но эта часть не отображается? echo('sssssssssssssss');   -  person Patrick    schedule 31.05.2014


Ответы (1)


Вы забыли ввести атрибут Name для SUBMIT.

Ваш код:

<input type="submit" value="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">

Измененный код:

<input type="submit" value="submit" name="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
person Rahul Balakrishna    schedule 31.05.2014