php - 电子邮件中的 PHP 表单输入
问题描述
我创建了一个将由用户输入的表单
<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:
'Huhhh' 是用户在 wc_message 上写的。他还写了 wc_phone,但没有显示在电子邮件中。wc_message 工作正常,但 wc_phone 没有。我究竟做错了什么?
解决方案
推荐阅读
- nhibernate - 当我在 Query 上调用 Update 方法时,为什么 NHibernate 会创建一个临时表?
- python - 云选择器中的 PySpark 异常
- c# - 有没有一种简单的方法可以在不使用循环的情况下创建相同对象的列表?
- resolvejs - 大型数据集的性能问题
- android - 尝试调用虚拟方法
- javascript - 当图像源是缩略图图像时如何调整图像大小
- mysql - 在创建 SQL 语句时需要帮助
- axapta - AX 2012 Group by 与公用表
- intellij-idea - IntelliJ IDEA 插件,用于最近的搜索项目
- laravel - 访问根 URL Laravel 时如何重定向