I have a report that I'm building in PHP. The fieldlist is dynamically generated by the user selecting fields on a parameter page.
My issue is this: I need to be able to check the results of the select to see if a certain field has been chosen, say 'name'. If 'name' has been chosen, I need to create a link to a javascript function from within the HTML page.
I'm generating the code using an example from the manual:
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
}
Currently, the code generated looks like this:
<td>Tom</td>
<td>555-1212</td>
If the user has chosen name and phone, I need the code generated to look like this (but only if they have chosen name as a value...)
<td><a href=\"javascript:FunctionName('Tom');\">Tom</a></td>
<td>555-1212</td>
If 'name' hasn't been chosen, the first method will work fine, because I don't need to do any other processing to the results. However, I need to be able to dynamically check if the field is 'name', and if it is, link it using the above method.
Sorry for the long post, and thanks for the help!
-J