Image

Imagegwynn_aaron wrote in Imagephp

"It depends on what the meaning of 'and' is..."

I have three values. I would like to print them on the page like this: value1 <br> value2 - value3. I want to set it up so that the <br> is actually a value as well, one which is printed or not based on the viability of value2 and value3. Here's what I have in my code right now:
if ($value2 == FALSE) {
$disp_value2 = "";
} else {
$disp_value2 = "
SKU: $value2
";
}

if ($value3 == FALSE) {
$disp_value3 = "";
} else {
$disp_value3 = "
- UPC: $value3
";
}

if ($value2 && $value3 == FALSE) {
$dispLine_break = "";
} else {
$dispLine_break = "
<br />
";
}


if ($value1 == FALSE) {
$disp_value1 = "";
} else {
$disp_value1 = "
<p class=\"smaller\"><span class=\"head\">$value1</span>$dispLine_break $disp_value2 $disp_value3</p>
";
}
So what should happen is that the <br> is printed as long as either value2 or value3 (or both) aren't false. But what is happening instead is that if either one of them is false the <br> is not printing. I'm sure this is something elementary and a stupid mistake or oversight on my part, but I need help. Thanks.