Forum Moderators: coopster
I need to take data from checkboxs that actually carry the names of table fields in the database.
After selecting from checkboxes, I only want to display the fields that were selected.
On form submit, I get the values of each field like this-
while (list ($key,$val) = @each ($_GET['fields'] )) {
echo $val.' ,';
}
But I have problems concatenating strings to get to get all the fields together.
Like fields = fields + $val
and then
echo fields
So that I can have select fields from table;
Is there any better method to follow the loop?
Thanks
Now I have another problem.
Suppose $cols = address, city, zipcode.
what is the efficient way of displaying fields that are in $cols.
One way I can think of is - trying with if loops. For 3 fields, there will be not less than 6 ifs (3!)...
echo '<td height="19" colspan="2"><div align="center"> ADDRESS
</div></td> ' ;
echo '<td width="14%" height="19"><div align="center"> CITY </div></td> ' ;
echo '<td width="10%" height="19"><div align="center">ZIPCODE </div></td> ' ;