'Putting two conditional results in a table

I am trying to put two conditionals if result statements in a table, but I am not able to get results.

So if the form input is empty then the result is not displayed.

To save space, I would like to place results in a table with two or three columns.

if(! empty($lect))
   $result .= '<p>' . __('<table class="custom-data"><span id="si" >Name:</span> ') . '<span id="si1" >' . $lect . '</span></table></p>';

if(! empty($lect1))
   $result .= '<p>'. __('<table class="custom-data"><span id="si">Product :</span> ') . '<br><span id="si1" >' . $lect1 . '</span></table></p>';

Present output:

Present Output

Expected output:

Desired Output in two columns



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source