using a search button output to modify an api httpGET request


I am trying (but failing as a newbie) to write some code that will allow a user to enter his/her COUNTRY into a search button on their browser. What I then need is that the output of their search (let’s say “USA” for example is then placed through my server into an API "httpGET"request in the appropriate position in the $xmlString. So, my request for HELP!! is 2-fold :

(1) Is the following code for the search button OK to give me the output that can then be used for step #2?

<form action="" method="get">
<input type="text" name="location"/>
<button type="submit">Submit</button>

(2) I then try to paste the country output from the search (through the code using the specific piece of code shown in the string below):
’ .'urlencode($_GET[‘location’]).

The intention is that this piece of code will fetch the Country "location"output (let’s say USA for example) and place it into the $xmlString :

This is what my httpGET code currently looks like, but it is not working for me!

$xmlString=httpGet(“’ .'urlencode($_GET[‘location’])/indicators/PA.NUS.PRVT.PP?date=2015:2015” );

I do believe that the rest of my code is OK as the code works if I physically type in the country as USA into the $xmlString in the intended loaction - my problem is that this change is not being executed…

Please help!