0

同様の問題をオンラインで検索しようとしましたが、うまくいきませんでした。ハイズ。your_email が通過できませんでした。

フォーム

echo '<form class=location_submit name="togo" action="" method="post" >';
    echo '<input class="user_email" type="text" name="your_email" placeholder="Enter your email here" required size="55"> <br />';
        echo '<input class="location_submit_button" type="image" name="button" src="images/send_location_button.png" />';
        echo '<input type="hidden" name="button_pressed" value="1" />';
echo '</form>';

メール機能

if(isset($_POST['button_pressed']))
{
    $to      = $your_email;
    $subject = "Sent from Utourpia!";
    $message = "Message body";

    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: Terence Leong @ Utourpia <terence@utourpia.me>" . "\r\n"; 
    $headers .= "Reply-To: terence@utourpia.me" . "\r\n";
    $headers .= 'Bcc: terence@popby.me' . "\r\n";
            $headers .= "X-Mailer: PHP/" . phpversion();

    mail($to, $subject, $message, $headers, '-f terence@utourpia.me');
    echo '<p class=email_sent>Email Sent.</p>';
}

注意すべきことは、送信ボタンをクリックすると送信された電子メールが実行されることですが、 $your_email は単に NULL を返します :((

4

1 に答える 1

3

名前を使用して $_POST から値を抽出する必要があります。

$to = $_POST['your_email'];
于 2013-07-08T14:36:02.647 に答える