Still trying to learn PHP, and I'm making a digital display for a homebrew bar setup I have and have a bit of code that should reading a CSV containing 5 beers, and spitting out the data for each beer. I have no issues parsing the CSV, displaying the strings and integers using echo, but when I tried to use an if statement, it starts spitting out the code as text
Here's my snippet of code:
<? if ($ibu['Beer1'] >= 1 && $ibu['Beer1'] <= 25):?>
Slightly bitter
<? elseif ($ibu['Beer1'] >= 26 && $ibu['Beer1'] <= 50) :?>
Kind of bitter
<? elseif ($ibu['Beer1'] >= 51) :?>
Very bitter
<? endif;?>
What I get when I load the page is this:
= 1 && $ibu['Beer1'] <=25):?> slightly bitter= 26 && $ibu['Beer1']<=50:?>Kind ofbitter=51):?>Very bitter
So it seems to be reading the "if" and "elseif" but spitting out everything else as text. As I said, I'm still teaching myself so I'm not entirely sure what could be causing it.
Aucun commentaire:
Enregistrer un commentaire