Roberth Roberth - 4 years ago 89
PHP Question

Send mail text entered in text entries 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="">

<input type="submit" value="SEND APP" name="submit21" />
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>";
$_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 = "";
$subject = "Vanity Roleplay Staff Application";

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

<h3>Username: ".$username."\n \n \n</br></h3>
<h3>SteamID64: ".$steamid2." , transform it to normal SteamID in <link></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>


// 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:' . "\r\n";


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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download