in reply to weird print results
When you say that t isn't populated are you commenting on the html source, or where the link goes when you actually click on it?
If the latter, then perhaps one of the values being output needs to be escaped.