电子邮件中的PHP表单输入

时间:2018-11-22 08:13:15

标签: php html wordpress forms

我创建了一个表单,该表单将由用户输入

<form id="wc-form-return" action="" method="post">
  <label><?php _e('Select products for return','wc_return') ?></label>
  <select id="wc_products[]" name="wc_products" class="wc_products" multiple="multiple">
    <?php
    if ( sizeof( $products ) > 0 ) { 
      foreach( $products as $item ) { ?>
        <option value="<?php echo $item['item_meta']['_product_id'][0]; ?>"><?php echo __(esc_html($item['name']), 'wc_return'); ?></option>
      <?php 
      }
    }
    ?>
  </select>
  <small><?php _e('You can select multiple by holding down the CMD or Ctrl key.','wc_return'); ?></small>
  <textarea name="wc_message" id="wc_message" cols="30" rows="10" placeholder="<?php _e('Explain the reasons for your return', 'wc_return') ?>"></textarea>
  <input type="hidden" name="order" value="<?php echo $order->id; ?>" />
  <input type="hidden" name="customer" value="<?php echo $order->billing_email; ?>" />
  <input type="text" name="phone" id="wc_phone" value="<?php echo $order->billing_phone; ?>" />
  <input type="checkbox" name="check1" value="Yes" required>Accept our <a href="https://sabkishop.in/return"> return and exchange policy </a> </br>
  <input type="submit" name="submit" value="<?php _e('Submit','wc_return'); ?>" />
</form>

它将由用户输入,我们将被发送到给定的电子邮件(已经设置)

现在要在我使用的电子邮件中提供这些信息

$note_form_email = '';
    if ( $_POST['wc_message'] != '' ) {
      $note .= '<br><br>';
      $note .= '<p>'.__('And the explanation:', 'wc_return').'</p>';
      $note_form_email .= '<p>'.__('And the explanation:', 'wc_return').'</p>';
      $note .= apply_filters( 'the_content', $_POST['wc_message'] );
      $note_form_email .= apply_filters( 'the_content', $_POST['wc_message'] );
      $note .= '<p>'.__('Customer details:', 'wc_return').'</p>';
      $note_form_email .= '<p>'.__('Customer details:', 'wc_return').'</p>';
      $note .= '<p>'.__('Customer phone:','wc_return').'</p>';
      $note_form_email .= '<p>'.__('Customer phone:','wc_return').'</p>';
      $note .= apply_filters('the_content', $_POST['wc_phone'] );
      $note_form_email .= apply_filters('the_content', $_POST['wc_phone'] );
    }

但是输出是这样的

And the explanation:
Huhhh
Customer details:
Customer phone:

用户在wc_message上写了“ Huhhh”。他还写了wc_phone,但没有显示在电子邮件中。 Wc_message工作正常,但wc_phone不是。我究竟做错了什么?

0 个答案:

没有答案