Q:

make tr visible depending on username all other unvisible

i have a table containing messages that are clickable links with the following structure:
<tr><td>#</td><td><a href='messages/". $file .".php'>$file</a></</td></tr>
...

$file always has this kind of structure as document name:
Date of submission [2014-02-19] - Subject [clean the garage] - To(everybody)

the table looks like this:
Date of submission [2014-02-19] - Subject [clean the garage] - To(Everybody)
Date of submission [2014-02-15] - Subject [clean the bathroom] - To(Annita)
Date of submission [2014-02-11] - Subject [clean the livingroom] - To(Rudy)

when a user logs in the $username echo's out for example Annita or Rudy or... Now what i would like to know if it is possible to make only the <tr> 's visible for the logged in user with according to(...) name
for example when Annita is logged in, she only gets to see the <tr>'s that has her name in it, and that for example the $file <tr> with Rudy becomes invisible. When the message is to(Everybody) all users can see the message
I hope my question is clear and somebody can help or explain me... thx in advance. breaking my head over this, and i cant change the structure of the message names...

A:

Why don't you use PHP to parse the file for $username? If $username exists in the file, then you include it. 
See here: PHP - parsing a txt file
E.g., I'm logged in as Rudy, so $username = 'Rudy.' Now I use PHP to find all the files that match the regular expression /To\(Rudy\)$/ (which you'll write dynamically based on $username) and include them. Javascript is definitely not the right tool for the job here.

