0

I have just started coding in PHP and I am having some issues to make this code work. I have tried to change from $_POST to $HTTP_POST_VARS , but I still cant get the value, anybody could point me what am I doing wrong and how to fix this code?

<?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\">";

?>

My HTML form.

<form action="contact.php" method="post">
<input type="text" class="textbox" value=" Your Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Name';}">
<input type="text" class="textbox" value="Your E-Mail" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your E-Mail';}">
<div class="clear"> </div>
<div>
<textarea value="Message:" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Message ';}">Your Message</textarea>
</div>                          
<div class="submit"> 
<input type="submit" value="SEND " />
</div>
</form>
Marcus Yee
  • 11
  • 2

1 Answers1

-1

See var_dump($_REQUEST). Default form submit uses $_GET object.

James
  • 119
  • 1
  • 8