Forum Moderators: coopster
I can't figure out how exactly to do this...
I have 4 variables. F1-4.
If ANY of them are set, I need that F value PLUS any others to be set.
HOWEVER...
If NO values are set, I need to have a default value. ie: FF.
I'm using this to set CSS parameters. So if there are no parameters, I need the decoration to be none.
I've tried many different methods, but this is the point I'm at now...
Here's my problem:
if ($F4 + $F3 + $F2 + $F1 <= "1") {
$FF = "text-decoration: none; ";
}
else if ($F4 > "1" ¦¦ $F3 > "1" ¦¦ $F2 > "1" ¦¦ $F1 > "1") {
$FF = "";
}
I either get ALL the CSS coming up with text-decor none or none of them have the text-decor none.
This is what I have BEFORE the code above setting the variables:
if ($F1 == F1) {
$F1 = "font-weight: bold; ";
}
else {
$F1 = "";
}
if ($F2 == F2) {
$F2 = "font-style: italic; ";
}
else {
$F2 = "";
}
if ($F3 == F3) {
$F3 = "text-decoration: underline; ";
}
else {
$F3 = "";
}
if ($F4 == F4) {
$F4 = "text-decoration: overline; ";
}
else {
$F4 = "";
}
$FF = $F1 . $F2 . $F3 . $F4;
if($FF == '')
$FF = 'text-decoration:none;';
What that does is concatenate the four variables. If all four are empty, then it sets $FF to no decoration, although it says nothing about a default font weight or style.
The bottom half is interesting. When you say $F1, you're talking about a variable. When you say F1 you're talking about a constant. Did you define four constants? If not, we'll need a little more info about how to decide what each of the $F_ variables are going to get set.