Hello
This is probably a dumb question because i cant find an answer anywhere, but when using PHP is HTML code affected by conditional statments?
say if i wanted to output a certain table ONLY if a variable equalled 1 or a different table if the variable equalled 2, could this be done?
if($colNum = 1 ){
echo <table>;
echo <tr>;
echo <td></td>;
echo </tr>;
}
if($colNum = 2){
echo <table>;
echo <tr>;
echo <td></td>;
echo <td></td>;
echo </tr>;
echo </table>;
}
i am trying something like this currently but the page loads all tables despite what the variable is equal to, im starting to think that HTML is not affected by conditional statments.
This is probably a dumb question because i cant find an answer anywhere, but when using PHP is HTML code affected by conditional statments?
say if i wanted to output a certain table ONLY if a variable equalled 1 or a different table if the variable equalled 2, could this be done?
if($colNum = 1 ){
echo <table>;
echo <tr>;
echo <td></td>;
echo </tr>;
}
if($colNum = 2){
echo <table>;
echo <tr>;
echo <td></td>;
echo <td></td>;
echo </tr>;
echo </table>;
}
i am trying something like this currently but the page loads all tables despite what the variable is equal to, im starting to think that HTML is not affected by conditional statments.





