"One more question" - That'd make the question too broad. Let's start by fixing one, then post another question afterwards, or edit your post to contain what you tried. Edit: this comment as per the original post stackoverflow.com/revisions/45904895/1
Yes you are right but from the question posted above, its appear that the question owner is concerned only about string for url that my code gives, so I addressed only that. No where he mentioned about $_GET