How do you use echo inside html table row?

前端 未结 5 1211
时光说笑
时光说笑 2021-01-29 12:40

I am using echo inside the HTML tr tag where I am getting an error.

Here is my code

index.php



        
5条回答
  •  无人共我
    2021-01-29 13:17

    The problem is not that you are inside a table row, but that you are inside a PHP string, and the answer is: You don't.

    You either:

    • Interpolate your variable
    • Concatenate your variable
    • Don't use echo and a string for the outside output

    Such:

    
    
        
    

    NB: You appear to be trying to nest table rows, which isn't allowed.

    You can probably dispense with the odd/even class names and just use :nth-child(odd) and :nth-child(even) in your stylesheet.

提交回复
热议问题