Getting "error" with a basic PHP contact form

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Sat Dec 22, 2012 12:33 am

When you send data from a form, you need to use $_POST['name'] to get the data that has been submitted, so in your case you need:

Code: Select all


// Contact subject
$subject =$_POST['subject'];

// Details

// Mail of sender

// From
$header="from: $_POST['name'] <$mail_from>";

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


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

Post Reply