I have a form processing script that takes my form info and emails to
me. Pretty basic and it works. But I'd like to be able to have it not
print a form variable if the value is empty. I know about using
if $($incoming_fie lds[$i] = "") {
to find the empty value. I'm just not sure about how to tell it to not
print the empty ones in the results. Can anyone help? Thanks.
Below is the current info used to populate the email sent to me:
//GET POST INFO
$incoming_field s = array_keys($_PO ST);
$incoming_value s = array_values($_ POST);
// LOAD EMAIL CONTENTS
for ($i = 0; $i < count($incoming _fields); $i++) {
if($incoming_fi elds[$i] != "rec_mailto ") {
if($incoming_fi elds[$i] != "rec_subjec t") {
if($incoming_fi elds[$i] != "rec_thanks ") {
if($incoming_fi elds[$i] != "opt_mailto_cc" ) {
if($incoming_fi elds[$i] != "opt_mailto_bcc ") {
// ADD FIELD TO OUTGOING MESSAGE
$message .= "$incoming_fiel ds[$i]: $incoming_value s[$i]\n";
}}}}}}
me. Pretty basic and it works. But I'd like to be able to have it not
print a form variable if the value is empty. I know about using
if $($incoming_fie lds[$i] = "") {
to find the empty value. I'm just not sure about how to tell it to not
print the empty ones in the results. Can anyone help? Thanks.
Below is the current info used to populate the email sent to me:
//GET POST INFO
$incoming_field s = array_keys($_PO ST);
$incoming_value s = array_values($_ POST);
// LOAD EMAIL CONTENTS
for ($i = 0; $i < count($incoming _fields); $i++) {
if($incoming_fi elds[$i] != "rec_mailto ") {
if($incoming_fi elds[$i] != "rec_subjec t") {
if($incoming_fi elds[$i] != "rec_thanks ") {
if($incoming_fi elds[$i] != "opt_mailto_cc" ) {
if($incoming_fi elds[$i] != "opt_mailto_bcc ") {
// ADD FIELD TO OUTGOING MESSAGE
$message .= "$incoming_fiel ds[$i]: $incoming_value s[$i]\n";
}}}}}}
Comment