Hi,
How do I say, if $contactname is empty, do not print it? It sounds easy but maybe I am not getting the syntax right. The following code works when just printing the variable in an email. Cheers...
"\n\n-- Contact Name --\n\n" . $contactname .
if (!empty($contactname)) { echo "\n\n-- Contact Name --\n\n" . $contactname; }
Thankyou!
Almost there but again I must have my syntax wrong somewhere as the php is not working. Do I put the if statement in brackets? Can or should I do it this way (checking for empty fields within the message?) Thank you
$message .= "\n\n-- Chk --\n\n" . $_POST['chkno'][0] . $_POST['chkno'][1] . $_POST['chkno'][2] . if (!empty($contactname)) { "\n\n-- Contact Name --\n\n" . $contactname; }
Try this...
$message .= "\n\n-- Chk --\n\n" . $_POST['chkno'][0] . $_POST['chkno'][1] . $_POST['chkno'][2] ; if (!empty($contactname)) { $message .= "\n\n-- Contact Name --\n\n" . $contactname; }
I'm afraid it still returns a blank screen, I really need to read up on syntax and PHP in general! Thank you for the replies though
Solved it! How do I say that I have solved it? Not sure how mind!
Click on "Mark Thread Resolved" under the "Thread Tools" option in the menu bar above.