When developing forms, just do this at the start of the form handling page;
var_dump( $_POST );
to keep an eye on what is actually happening to the variables, 0 (integer) is not the same as '0' (string) - though PHP will try and process them the same if you do not enforce strictness.
But to answer your question, about explicitly testing for 0's, and making conditions depending upon them.
This sample below works for both 0 and '0', by consciously not enforcing strictness with === or !== but using !=
An example showing how to then use concatenate to add to a string to build up your message.
PHP Code:
$pfw_header = "This is the start of the message.\n";
$pfw_header .= "This is line two \n";
if( $phone != 0 ) $pfw_header .= "Tel: $phone\n" ;
echo $pfw_header ;
Why all those @ error suppressors?
Bookmarks