fix url encoding and show how to encode params with a foreach loop.