I am really new to PHP and I am currently experimenting on how to create a Form on DreamWeaver.I watched several tutorials to gather information on how to create an effective Form with a script on PHP.
I have a Form that will ask user to input their first name, last name, email, phone number but I can't seem to figure out what's wrong. Here's the code.
Code: Select all
<?php
/* newbie me */
/* Subject and Email */
$emailSubject = 'sample';
$emailBoss = 'sampleemail@gmail.com';
/*Gathering Data Variables */
$fnameField = $_POST['firstname'];
$lnameField = $_POST['lastname'];
$emailField = $_POST['emailaddress'];
$rnameField = $_POST['namerecipient'];
$phoneField = $_POST['phone'];
$body = <<<EOD
<br><hr><br>
First Name: $fnameField <br>
Last Name: $lnameField <br>
Email Address: $emailField <br>
Name of Recipient: $rnameField <br>
Phone: $phoneField
EOD;
$headers = "From: $emailaddress\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($emailBoss, $emailSubject, $body, $headers);
?>I'm really new to PHP programming so I am having hard time to figure out what's wrong with the code.
Suggestions are very much appreciated.
Thanks,
iskawt