提交表单后$ _POST中没有值

时间:2015-10-05 14:51:31

标签: php

我刚开始用PHP编码,我遇到了一些使这段代码工作的问题。我试图从<style> #div1, #div3{ float: right; height: 100px; width: 100px; border: 1px solid blue; } #div2, #div2-1{ float: left; height: 50px; width: 50px; border: 1px solid red; } #div2-1{ clear: right; } #div3{ clear: left; border: 1px solid green; } </style> <div class="row"> <div id="div1">DIV1</div> <div id="div2">DIV2</div> <div id="div2-1">DIV2-1</div> <div id="div3">DIV3</div> </div> 更改为$_POST,但我仍然无法获得价值,任何人都可以指出我做错了什么以及如何修复此代码?

$HTTP_POST_VARS

我的HTML表单。

<?php


$email_address = "email@email.com";
// your e-mail address goes here

$email_subject = "Online Enquiry";
// the subject line for the e-mail goes here

$from_email_name = "email@email.com";
// the from address goes here 

$redirect_to_page = "thankyou.html";
// enter the web address where the user should be sent after completing the form

//*********************************
// DO NOT EDIT BELOW THIS LINE!!!**
//*********************************


$mailTo = "$email_address";

$mailSubject = "$email_subject";

$mailBody = "The form values entered by the user are as follows: \n\n";

foreach($_POST as $key=>$value)
{

 $mailBody .= "$key = $value\n";

}



$mailBody .= "\n\n";


 $fromHeader = "From: $from_email_name\n";


if(mail($mailTo, $mailSubject, $mailBody, $fromHeader)) 
{

    print ("<B><br></b>");

}

echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$redirect_to_page\">";

?>

1 个答案:

答案 0 :(得分:-1)

请参阅var_dump($ _ REQUEST)。默认表单提交使用$ _GET对象。