InMotion Hosting Support Center

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

2013-05-21 9:22 am EST

Hits: 490
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

<form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<td width="82%"><p2 style="font-weight: bold">My Shelter</p2>
<textarea name="detail" cols="8" id="detail"></textarea></td>
<td colspan="3" style="text-align: center"><p2><input type="submit" name="Submit" value="Submit"></p2></td>

PHP Action Script

// Contact subject
$subject ="Contact Form";

// Detail
$message ="$detail";

// Enter your email address
$to ="";


// Check, if message sent to your email
// display message "We've received your information"
echo "I received your information";
else {
echo "ERROR";

Thanks for your help.

You must login before you can ask a follow up question.

You must login before you can submit an answer.



5,889 Points
2013-05-21 12:29 pm EST
Hello csummerfield!

In order for your form variables to receive the data, you will need to use one of the following to get them.

<pre style="padding:10px;">$_GET['variable'];<br />$_POST['variable'];<br />$_REQUEST['variable'];</pre>
I revamped your code so it works. Please see the folloowing.
<pre style="padding:10px;">&lt;?php
if (isset($_REQUEST['Submit'])){
$subject = "Contact Form";<br />$message = 'You received the comment ' . $_REQUEST['detail'] . ' from your site! ';<br />$to ="";<br />$send_contact = mail($to,$subject,$message); <br />
if($send_contact){<br />echo '&lt;p>I received your information&lt;/p>&lt;p>You typed: ' . $_REQUEST['detail'] . '&lt;/p>';<br />}else{echo 'There was a problem with the email!';}<br />}else {?>
&lt;form name="form1" method="post"><br />My Shelter&lt;br /><br />&lt;textarea name="detail" cols="20" id="detail">&lt;/textarea>&lt;br /><br />&lt;input type="submit" name="Submit" value="Submit"><br />&lt;/form>
&lt;?php } ?></pre>
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 <a href="" target="_blank">How to create a custom PHP contact form with validation</a>. 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

You must login before you can post a comment about this answer.

Hey James, You da man! Thank you so much. I can't tell you how many hours I put in researching and trying it out. You have certainly made my day. Thanks again.
8 Points
2013-05-21 3:03 pm EST
Like this Question?

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!