簡體   English   中英

發送在文本條目PHP和HTML中輸入的郵件文本

[英]Send mail text entered in text entries PHP & HTML

我希望此php向我發送一封包含所有在文本條目中輸入的文本的郵件,但是當我單擊“提交”時,它不會發送任何信息。 這是代碼:

<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."\n \n \n</br></h3>
<h3>SteamID64: ".$steamid2." , transform it to normal SteamID in      <link>steamid.io</link>\n \n \n</br></h3>
<h3>Horary Time: ".$horarytime."\n \n \n</br></h3>
<h3>LUA Knowledge: ".$luaknowledge."\n \n \n</br></h3>
<h3>ULX Knowledge: ".$ulxknowledge."\n \n \n</br></h3>
<h3>Servers played as admin: ".$anotherservers."\n \n \n</br></h3>
<h3>Hours Played IG URL: ".$hoursplayed."\n \n \n</br></h3>
<h3>Warns URL: ".$warnsurl."\n \n \n</br></h3>
<h3>Has mic: ".$hasmic."\n \n \n</br></h3>
<h3>Hours online provided: ".$hoursonlineprovided."\n \n \n</br></h3>
<h3>Why wants to be part from the staff team: ".$whywantstobefromthestaff."\n \n \n</br></h3>
<h3>Actual rank: ".$actualrank."\n \n \n</br></h3>
<h3>Has donated: ".$hasdonated."\n \n \n</br></h3>
<h3>Age: ".$age."\n \n \n</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" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

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

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

有什么辦法可以修復它?,正如我所說,我找不到修復程序,我只是沒有從PHP文件中獲取有關郵件的信息

您分配錯誤。

 $_POST['username']  = $username;

將它們全部更改為

 $username = $_POST['username'];

這些值在POST因此從POST獲取值,您可以用其他方法來完成。

這是工作版本。

請享用:)

 <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."\n \n \n</br></h3>
<h3>SteamID64: ".$steamid2." , transform it to normal SteamID in      <link>steamid.io</link>\n \n \n</br></h3>
<h3>Horary Time: ".$horarytime."\n \n \n</br></h3>
<h3>LUA Knowledge: ".$luaknowledge."\n \n \n</br></h3>
<h3>ULX Knowledge: ".$ulxknowledge."\n \n \n</br></h3>
<h3>Servers played as admin: ".$anotherservers."\n \n \n</br></h3>
<h3>Hours Played IG URL: ".$hoursplayed."\n \n \n</br></h3>
<h3>Warns URL: ".$warnsurl."\n \n \n</br></h3>
<h3>Has mic: ".$hasmic."\n \n \n</br></h3>
<h3>Hours online provided: ".$hoursonlineprovided."\n \n \n</br></h3>
<h3>Why wants to be part from the staff team: ".$whywantstobefromthestaff."\n \n \n</br></h3>
<h3>Actual rank: ".$actualrank."\n \n \n</br></h3>
<h3>Has donated: ".$hasdonated."\n \n \n</br></h3>
<h3>Age: ".$age."\n \n \n</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" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM