php $ _POST []没有得到值

时间:2015-05-20 18:44:44

标签: php

当用户开户时,我正在使用PHP向自己发送电子邮件。它包含用户名,密码和电子邮件:

<?php
    $code = isset( $_GET['code'] ) ? $_GET['code'] : 0;
if ( $code == 1 ) {
    echo "Your account has been created.";

   $master_to = "email@gmail.com";
   $headers = 'MIME-Version: 1.0' . "\r\n";
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
   $master_user = $_POST["username"];
   $master_password = $_POST["password"];
   $master_ema = $_POST["mail"];
   $info = "Username:" .  $user . " Password: " . $password . " Email: " . $ema; 
   mail($master_to, "User Request", $info, $headers); 


   $a_to = $_POST["mail"];
   $a_message = '<h3 style="font-size:30pt; font-family:impact, fantasy; border:5px solid gray; color:green; border-radius:3px; background: linear-gradient(blue, gray); padding:15px;">SarkellianCreed.com</h3><br><br><br><p style="font-family:calibri, sans-serif; padding:20px;">Welcome to SarkellianCreed.com! Click <a href="http://www.sarkelliancreed.comule.com/accountfinalstep">here</a> to confirm your account.</p><p style="font-family:calibri, sans-serif; padding:20px;">If the link doesn&apos;t open, paste this address into your browser bar: <input type="text" value="http://www.sarkelliancreed.comule.com/accountfinalstep"></p>';
   mail($a_to,"Account Confirmation | SarkellianCreed.com", $a_message, $headers);








} else if ( $code == 2 ) {
    echo "Thank you for your feedback, " . $_POST["name"] . ".";
    if ( isset( $_POST["sent"] ) ) {
        echo "You will receive an email at " . $_POST["youremail"] . ".";
    }
}


?>

该页面也用于其他用法,这是else if($code == 2){}正在做的事情。该页面为here 当用户创建帐户时,用户名,密码和电子邮件应显示在文本框中,但不显示任何内容。我曾经使用this来完成这项工作。它也没有用。

1 个答案:

答案 0 :(得分:6)

为什么要设置$ _POST?你正在使用GET:

<form  id="ffresult_sbox0" ...snip... method="get" accept-charset="utf-8"...
                                      ^^^^^^^^^^^^