String temp1=(String)firstname.getText().toString();
String temp2=(String)lastname.getText().toString();
String urlreg="http://localhost/welcome.php?firstname="+temp1+"&lastname="+temp2;
Here firstname and lastname are the editText fields.
I am getting error as below.
LogCat error:
09-11 22:11:09.529: E/AndroidRuntime(1204): FATAL EXCEPTION: main
09-11 22:11:09.529: E/AndroidRuntime(1204): java.lang.IllegalArgumentException: Illegal character in query at index 54: http://localhost/welcome.php?firstname=ji&lastname=kij
The code works fine if I modify it to
String urlreg="http://localhost/welcome.php?firstname="+temp1+"&lastname";
Where am i going wrong?
Before using urlreg you need to url encode it to take out special characters using URLEncoder.encode().