0
<?php
/*
...
*/
add_action('init', 'register_shortcode_mail');
function register_shortcode_mail(){
add_shortcode('mail-sender', 'mail_sender_function');
}
function mail_sender_function(){
echo "<form name='myForm' method='POST'>
Subject: <input type='text' name='subject'>
<textarea rows = '5' cols = '80' name = 'message' form = 'usrform'>
</textarea>
<input type = 'Submit' name='btn' value = 'Send'>
</form>";
if(isset($_POST['btn'])){
$sub = $_POST['subject'];
$mes = $_POST['message'];
echo "$mes";
}
}
?>
嗨。我試圖在wordpress站點上顯示textarea($ mes)的內容,但是每當我點擊Submit btn時,所有包含文本的輸入框都會清除它們自己,並且沒有任何迴應。從textarea顯示變量WP
可以代替isset($ _ POST [ 'BTN'])與$ _ SERVER [ 「REQUEST_METHOD」] == 「POST」,並嘗試 – 2015-02-08 23:30:33
哇!有用!謝謝。 – user3142434 2015-02-08 23:35:29
我推銷它,你能接受嗎? – 2015-02-08 23:44:32