Moved to the PHP forum.
Please make sure your questions are clear, and that you are posting in the proper forums. This question has nothing to do with CSS (you didn't even include any css in your post).
Your email body is empty because you didn't put anything in it:
PHP Code:
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
You should make sure you have error reporting enabled during development.
PHP Code:
<?php
error_reporting( -1 );
ini_set( 'display_errors',1 );
All of those POST variables are undefined (and therefore empty). That's because your form isn't using the POST method - it's using GET. Try using POST:
HTML Code:
<form method="POST" action="contact.php" id="form">
Also, you have a security vulnerability here:
PHP Code:
$headers = 'From:'.$cf_email."\r\n";
$headers .= 'Reply-To: '.$cf_email."\r\n";
You assume that
$cf_email is an email address, but you don't check. What if I wrote:
my@email.com\r\nCC: <spam-mailing-list>\r\n
?
You're a spam server!
You need to
validate that the email I submitted
is an email address. It's very simple:
PHP Code:
if( ! filter_var( $cf_email,FILTER_VALIDATE_EMAIL ) ){
/* not a valid email! don't use it */
}
Bookmarks