Sign in to follow this  

double data posting

Recommended Posts

Original Poster    324

hello I cant work out how to post two bits of data to a PHP script ... I can post one name pair but the other one just adds on to the other and does not become its own post value ... how would i go about this?

 

small snippet below

 

 

String data = (URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(username, "UTF-8")) + (URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8"));
    URLConnection connection = url.openConnection();
    ((HttpURLConnection)connection).setRequestMethod("POST");
 

Share this post


Link to post
Share on other sites
snaphat (Myles Landwehr)    414

 

hello I cant work out how to post two bits of data to a PHP script ... I can post one name pair but the other one just adds on to the other and does not become its own post value ... how would i go about this?

 

small snippet below

 

 

String data = (URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(username, "UTF-8")) + (URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8"));
    URLConnection connection = url.openConnection();
    ((HttpURLConnection)connection).setRequestMethod("POST");

 

 

add an "&" inbetween the two? Note, i didn't actually check this.

 

I.e. 

String data = (URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(username, "UTF-8")) + "&" + (URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8"));

Share this post


Link to post
Share on other sites
Original Poster    324

 

add an "&" inbetween the two? Note, i didn't actually check this.

 

I.e. 

String data = (URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(username, "UTF-8")) + "&" + (URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8"));

 

 

hmm maybe ok il give it a go xD might have been the mistke i made 

Share this post


Link to post
Share on other sites
firey    3,622

hmm maybe ok il give it a go xD might have been the mistke i made 

Would make sense. PHP's $_GET['field']  would look like ?param1=value&param2=value&....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.