Hi,
I am wondering if this is an ok solution to my problem. So I have a table and the user selects which columns to show. This outputs in a table format.
As it outputs I need to specify the table head <th>
title and then loop though the results and create a <td>
for each record.
The problem is that I want to do an ‘if’ for each variable so it needs to outside the loop for the table head and inside the loop for the table cells.
This is how I am starting
‘<?php
if($_GET['f_scientific_name']=='1'){
$field_head = '`Scientific name`';
$field = '`$latin_name`';
}
?>’
(ignore the ` in the variables I couldn’t get it to show on here otherwise)
So I can then echo out $field_head before the loop.
and then in the loop I do this
eval("\$field = \"$field\";"); echo $field;
Is this a bad way of doing it? Security wise I am not too concerned as the get variable is not used directly, only to turn on or off the field to be displayed.
How else could I do it if this is not a suitable solution.
thanks