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:
Expected output:
Please see the below to separate into separate columns:
$result .= '<table class="custom-data"><tr>';
if( ! empty( $lect ) )
$result .= '<td><p>' . __('<span id="si" >Name:</span> ') . '<span id="si1" >' . $lect . '</span></p></td>';
if( ! empty( $lect1 ) )
$result .= '<td><p>' . __('<span id="si">Product :</span> ') . '<br><span id="si1" >' . $lect1 . '</span></p></td>';
$result .= '</tr></table>';
Then I guess you are returning $result
. This puts the result in one row and conditional columns.