我希望这个php向我发送一封邮件,其中包含在文本条目中输入的所有文本,但是当我点击“提交”时,它不会发送任何信息。下面是代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:background="@color/Primary_Background_Color"
android:orientation="vertical"
android:weightSum="1">
<android.support.v7.widget.CardView
android:id="@+id/card_view_drop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#FFFFFF"
card_view:cardPreventCornerOverlap="false"
>
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"
android:layout_gravity="bottom"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white"/>
<RelativeLayout
android:id="@+id/click_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:background="@drawable/custom_bg">
<android.support.v7.widget.Toolbar
android:id="@+id/trickle_card_tool_bar"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#BBDEFB"
/>
<ImageView
android:id="@+id/profile_picture"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_user_default"
android:background="@drawable/custom_bg"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/profile_picture"
android:width="50dp"
android:text="Kevin Hodges"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp"
android:textColor="#000000"
android:singleLine="true"
android:layout_alignTop="@+id/profile_picture"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_toStartOf="@+id/menu_button"
android:layout_toLeftOf="@+id/menu_button"
android:background="@drawable/custom_bg_blue"
android:clickable="true"
android:textStyle="bold"/>
<TextView
android:id="@+id/comment_created_at"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="September 18, 2015 @ 3:32 p.m."
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="10sp"
android:singleLine="true"
android:background="@drawable/custom_bg"
android:gravity="left"
android:layout_alignBottom="@+id/profile_picture"
android:layout_alignRight="@+id/menu_button"
android:layout_alignEnd="@+id/menu_button"
android:layout_toRightOf="@+id/profile_picture"
android:layout_marginLeft="8dp"
/>
<TextView
android:id="@+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="true"
android:focusable="false"
android:maxLines="5"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:singleLine="false"
android:text="Description"
android:layout_below="@+id/profile_picture"
android:textColor="@color/PrimaryText"
android:textSize="14sp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="32dp"
android:background="@drawable/custom_bg"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/menu_button"
android:layout_marginLeft="8dp"
android:src="@drawable/menu_svg"
android:layout_alignBottom="@+id/trickle_card_tool_bar"
android:layout_marginBottom="16dp"
android:background="@drawable/custom_bg_blue"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginRight="2dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""Mother Teresa""
android:id="@+id/author_rank"
android:textSize="14sp"
android:singleLine="false"
android:gravity="left|center_vertical|center_horizontal"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:textStyle="italic"
android:layout_below="@+id/name"
android:layout_alignBottom="@+id/trickle_card_tool_bar"
android:textColor="#7d000000"
android:layout_toStartOf="@+id/menu_button"
android:layout_marginTop="-4dp"
android:layout_toLeftOf="@+id/menu_button"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<AutoCompleteTextView
android:id="@+id/enter_comment_text"
android:layout_width="235dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/button_post_comment"
android:layout_toLeftOf="@+id/button_post_comment"
android:layout_toRightOf="@+id/post_comment_profile_picture"
android:layout_toStartOf="@+id/button_post_comment"
android:background="#ffffff"
android:hint="@string/write_comment_hint"
android:inputType="textCapSentences|textAutoComplete|textAutoCorrect|text"
android:maxLength="250"
android:paddingLeft="8dp"/>
<ImageView
android:id="@+id/post_comment_profile_picture"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:foregroundGravity="center_vertical"
android:scaleType="centerCrop"
android:src="@drawable/ic_user_default"/>
<Button
android:id="@+id/button_post_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:width="50dp"
android:background="@color/AccentColor"
android:text="Post"
android:textColor="#ffffff"/>
Theres有什么方法可以解决它吗?正如我所说,我无法找到修复程序,我只是得到没有关于我从php文件中获取的邮件的信息
答案 0 :(得分:0)
您错误地分配了它。
$_POST['username'] = $username;
将所有内容更改为
$username = $_POST['username'];
值在POST
中,因此从POST
获取值,您正在以另一种方式执行此操作。
答案 1 :(得分:0)
这是一个正常工作的版本。
享受:)
<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);
}
?>