Oh boy, I just knew you would come back! Even when the answer is given to you on a silver platter...Seriously, one of these days you just need to stop and actually learn the fundamentals of PHP or any programming language before you come here begging for help with every tiny problem you run into. You may think I'm being cruel and mean with my attitude, well I am. No one learns anything by getting all the answer in life handed to them, why should programming be the same?
If you had any grasp of the fundamentals of PHP, or programming in general you could easily see the error you made. But you cannot because all you have ever done is ask for an answer and took it without question or understanding it. Do you want to know why your code does not work? Look real hard at it, imagine the process it goes though in your head. What is the result?
Furthermore, get ride of the for loop, do not use a foreach loop or any loop for that matter, its not required. gvre, gave you every single thing you needed, minus the foreach loop. How could you miss that?