Question by a novice, here:
I have a simple form returning a person's name, company, and address among other things.
Right now, these are returned on separate lines. If there is no entry in the "company" field, there is a blank line in the email that is sent.
I'd like to make an IF statement so that if there is no entry in the "company" field, that "address" will come back right after "name" without an extra space, but will include the "company" info if that field is filled-in.
The relevant part of the PHP code looks like this:
$name = $_POST['name'];
$company = $_POST['company'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$optin = $_POST['optin'];
$comments = ($_POST['comments']);
$body = <<<EOD
Please send samples to:
$name
$company
$address
$city, $state $zip
Email: $email
Opt-In to occasional email list?: $optin
Comments: $comments
EOD;
$headers = "From: $email\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
I will really appreciate your help!