我有一个wordpress网站,其中Iv分配了一个全局变量$ rushad,并给它在我的产品页面上找到的文本框的值。
global $rushad;
if((isset($_POST['tmcp_textfield_0'])) && !empty($_POST['tmcp_textfield_1']))
{
$rushad= $_POST['tmcp_textfield_0']; //note i used $_POST since you have a post form **method='post'**
}
我现在想要使用此信息来触发来自我使用的插件的电子邮件。
为此,我修改了这样的插件代码....
function woocommerce_gift_coupon_send_action( $post_ids ) {
global $wpdb;
require_once WOOCOMMERCE_GIFT_COUPON_DIR . 'includes/mail-template.php';
$generated_coupon = 0;
foreach ( $post_ids as $post_id ) {
$order = new WC_Order( $post_id );
$items = $order->get_items();
$mailto = $rushad;
$coupons_mail = array();
$sc = false;
$coupons_to_generated = woocommerce_gift_coupon_check_order_coupons_count( $post_id );
$coupons_generated = woocommerce_gift_coupon_check_order_coupons( $post_id );
但它还没有工作。
关于我搞砸的地方的任何建议?
变量$ rushad不起作用,因为它没有定义。
这将像这个全球$ rushad一样工作;