How do you run your code minazfath? Do have a server on your computer or do have a test site? I ask because your php throws errors all over the place. And when run looking at the source code of the generated HTML tells a story.