donglu7286
donglu7286
2016-01-01 06:55
浏览 29
已采纳

发送在文本条目PHP和HTML中输入的邮件文本

I want this php to send me a mail with all the text entered on the text entries, but when i click "Submit", it doesnt send any info. Heres the code:

<form  method='post'>

                <input name="username" type="text" placeholder="Username" required="">

      <input name="steamid" type="text" placeholder="SteamID64" required="">

                <input name="horarytime" type="text" placeholder="Horary Time" required="">

                <input name="lua" type="text" placeholder="Do you know about LUA" required="">

      <input name="ulx" type="text" placeholder="Do you know about ULX" required="">

      <input name="server" type="text" placeholder="If you were admin on another servers, mention them" required="">

      <input name="hoursplayed" type="text" placeholder="Paste here your total hours played in the server picture URL" required="">

      <input name="warns" type="text" placeholder="Paste here your warns picture URL, !warns IG" required="">

      <input name="mic" type="text" placeholder="Do you have a mic?" required="">

      <input name="online" type="text" placeholder="How much hours you can play weekly?" required="">

      <input name="why" type="text" placeholder="Why do you want to be part of the staff?" required="">

      <input name="rank" type="text" placeholder="What rank are you on the server? " required="">

      <input name="donated" type="text" placeholder="Did you buyed anything on the server? if so, specify what" required="">

      <input name="email" type="text" placeholder="Type EMAIL to be answered" required="">

                <input name="age" type="text" placeholder="Type your age" required="">
                </div>


            <input type="submit" value="SEND APP" name="submit21" />
          </form>
      <?php 
      if (isset($_POST['submit21'])) {
    echo "<h4>Your apply has been sended successfully, check your mail within 1 day to 7 days to get your answer from the staff team.</h4>";
    header("refresh:5;url=../apply/steamauth/logout.php");
$_POST['username']      = $username;
$_POST['steamid']       = $steamid2;
$_POST['horarytime']    = $horarytime;
$_POST['lua']         = $luaknowledge;
$_POST['ulx']         = $ulxknowledge;
$_POST['server']      = $anotherservers;
$_POST['hoursplayed']     = $hoursplayed;
$_POST['warns']       = $warnsurl;
$_POST['mic']         = $hasmic;
$_POST['online']      = $hoursonlineprovided;
$_POST['why']         = $whywantstobefromthestaff;
$_POST['rank']        = $actualrank;
$_POST['donated']       = $hasdonated;
$_POST['age']         = $age;
$_POST['email']       = $mail;

$to = "noreply@vanityrp.site.nfoservers.com";
$subject = "Vanity Roleplay Staff Application";

$message = "
<html>
<head>
<title>Vanity Roleplay Staff Aplication</title>
</head>
<body>

<h3>Username: ".$username."
 
 
</br></h3>
<h3>SteamID64: ".$steamid2." , transform it to normal SteamID in      <link>steamid.io</link>
 
 
</br></h3>
<h3>Horary Time: ".$horarytime."
 
 
</br></h3>
<h3>LUA Knowledge: ".$luaknowledge."
 
 
</br></h3>
<h3>ULX Knowledge: ".$ulxknowledge."
 
 
</br></h3>
<h3>Servers played as admin: ".$anotherservers."
 
 
</br></h3>
<h3>Hours Played IG URL: ".$hoursplayed."
 
 
</br></h3>
<h3>Warns URL: ".$warnsurl."
 
 
</br></h3>
<h3>Has mic: ".$hasmic."
 
 
</br></h3>
<h3>Hours online provided: ".$hoursonlineprovided."
 
 
</br></h3>
<h3>Why wants to be part from the staff team: ".$whywantstobefromthestaff."
 
 
</br></h3>
<h3>Actual rank: ".$actualrank."
 
 
</br></h3>
<h3>Has donated: ".$hasdonated."
 
 
</br></h3>
<h3>Age: ".$age."
 
 
</br></h3>


<h1><font color='red'>PLEASE BE SURE TO MAIL TO '".$mail."' IF HE DID IT OR NOT!</h1></font>

<h1>THIS IS AN AUTOMATED MESSAGE, PLEASE DO NOT REPLY!</h1>
</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";

// More headers
$headers .= 'From: noreply@vanityrp.site.nfoservers.com' . "
";

mail($to,$subject,$message,$headers);
      }
      ?>

Theres any way to fix it?, as i said, i cant found the fix and im just getting no info on the mail i get from the php file

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douyulv6921
    douyulv6921 2016-01-01 06:58
    已采纳

    You are assigning it wrongly.

     $_POST['username']  = $username;
    

    change all of them to

     $username = $_POST['username'];
    

    The values are in POST so get the values from POST, you are doing it the other way.

    点赞 评论
  • dsndm82062
    dsndm82062 2016-01-01 07:08

    Here's a working version.

    Enjoy:)

     <form  method='post'>
    
                    <input name="username" type="text" placeholder="Username" required="">
    
          <input name="steamid" type="text" placeholder="SteamID64" required="">
    
                    <input name="horarytime" type="text" placeholder="Horary Time" required="">
    
                    <input name="lua" type="text" placeholder="Do you know about LUA" required="">
    
          <input name="ulx" type="text" placeholder="Do you know about ULX" required="">
    
          <input name="server" type="text" placeholder="If you were admin on another servers, mention them" required="">
    
          <input name="hoursplayed" type="text" placeholder="Paste here your total hours played in the server picture URL" required="">
    
          <input name="warns" type="text" placeholder="Paste here your warns picture URL, !warns IG" required="">
    
          <input name="mic" type="text" placeholder="Do you have a mic?" required="">
    
          <input name="online" type="text" placeholder="How much hours you can play weekly?" required="">
    
          <input name="why" type="text" placeholder="Why do you want to be part of the staff?" required="">
    
          <input name="rank" type="text" placeholder="What rank are you on the server? " required="">
    
          <input name="donated" type="text" placeholder="Did you buyed anything on the server? if so, specify what" required="">
    
          <input name="email" type="text" placeholder="Type EMAIL to be answered" required="">
    
                    <input name="age" type="text" placeholder="Type your age" required="">
                    </div>
    
    
                <input type="submit" value="SEND APP" name="submit21" />
              </form>
          <?php
          if (isset($_POST['submit21'])) {
        echo "<h4>Your apply has been sended successfully, check your mail within 1 day to 7 days to get your answer from the staff team.</h4>";
        header("refresh:5;url=../apply/steamauth/logout.php");
    $username = $_POST['username'];
    $steamid2 = $_POST['steamid'];
    $horarytime = $_POST['horarytime'];
    $luaknowledge = $_POST['lua'];
    $ulxknowledge = $_POST['ulx'];
    $anotherservers = $_POST['server'];
    $hoursplayed = $_POST['hoursplayed'];
    $warnsurl = $_POST['warns'];
    $hasmic = $_POST['mic'];
    $hoursonlineprovided = $_POST['online'];
    $whywantstobefromthestaff = $_POST['why'];
    $actualrank = $_POST['rank'];
    $hasdonated = $_POST['donated'];
    $age = $_POST['age'];
    $mail = $_POST['email'];
    
    $to = "noreply@vanityrp.site.nfoservers.com";
    $subject = "Vanity Roleplay Staff Application";
    
    $message = "
    <html>
    <head>
    <title>Vanity Roleplay Staff Aplication</title>
    </head>
    <body>
    
    <h3>Username: ".$username."
     
     
    </br></h3>
    <h3>SteamID64: ".$steamid2." , transform it to normal SteamID in      <link>steamid.io</link>
     
     
    </br></h3>
    <h3>Horary Time: ".$horarytime."
     
     
    </br></h3>
    <h3>LUA Knowledge: ".$luaknowledge."
     
     
    </br></h3>
    <h3>ULX Knowledge: ".$ulxknowledge."
     
     
    </br></h3>
    <h3>Servers played as admin: ".$anotherservers."
     
     
    </br></h3>
    <h3>Hours Played IG URL: ".$hoursplayed."
     
     
    </br></h3>
    <h3>Warns URL: ".$warnsurl."
     
     
    </br></h3>
    <h3>Has mic: ".$hasmic."
     
     
    </br></h3>
    <h3>Hours online provided: ".$hoursonlineprovided."
     
     
    </br></h3>
    <h3>Why wants to be part from the staff team: ".$whywantstobefromthestaff."
     
     
    </br></h3>
    <h3>Actual rank: ".$actualrank."
     
     
    </br></h3>
    <h3>Has donated: ".$hasdonated."
     
     
    </br></h3>
    <h3>Age: ".$age."
     
     
    </br></h3>
    
    
    <h1><font color='red'>PLEASE BE SURE TO MAIL TO '".$mail."' IF HE DID IT OR NOT!</h1></font>
    
    <h1>THIS IS AN AUTOMATED MESSAGE, PLEASE DO NOT REPLY!</h1>
    </body>
    </html>
    ";
    
    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "
    ";
    $headers .= "Content-type:text/html;charset=UTF-8" . "
    ";
    
    // More headers
    $headers .= 'From: noreply@vanityrp.site.nfoservers.com' . "
    ";
    
    mail($to,$subject,$message,$headers);
          }
          ?>
    
    点赞 评论

相关推荐