What is the problem with an email form when receiving a white page?

Avatar
  • Answered
I have created a one field PHP comment form to be sent via email. It's being sent and received, but it is not giving me the message details. The page on the website is located at http://www.naturaldogremedies.net HTML Form
My Shelter
PHP Action Script Thanks for your help.
Avatar
jamesr
Hello csummerfield! In order for your form variables to receive the data, you will need to use one of the following to get them.
$_GET['variable'];
$_POST['variable'];
$_REQUEST['variable'];
I revamped your code so it works. Please see the folloowing.
<?php
if (isset($_REQUEST['Submit'])){
$subject = "Contact Form";
$message = 'You received the comment ' . $_REQUEST['detail'] . ' from your site! ';
$to ="[email protected]";
$send_contact = mail($to,$subject,$message);
if($send_contact){
echo '<p>I received your information</p><p>You typed: ' . $_REQUEST['detail'] . '</p>';
}else{echo 'There was a problem with the email!';}
}else {?> <form name="form1" method="post">
My Shelter<br />
<textarea name="detail" cols="20" id="detail"></textarea><br />
<input type="submit" name="Submit" value="Submit">
</form> <?php } ?>
Add the code to one php page. The code will run from the same page as the form. You can add or change it as necessary. You will want to review my article on How to create a custom PHP contact form with validation. The form you have will accept any data. you will want to add validation to it to prevent spam bots from hitting the form Best regards, James R