🔒 Closed Android string post

Status
Not open for further replies.

Netflix

Forum Veteran
Using GenAsync/AsyncTask library ,
nacoconfused po ako sa syntax neto sa posting,
Code:
  String post_data = URLEncoder.encode("username","UTF-8") + "=" +URLEncoder.encode(username,"UTF-8");
Ano pong reference nong pinakaunang URLEncoder.encode? At yung pangalawa , yung walang string(double quote)


Sana po may makasagot.
 
tingin ko po yung sa first URLEncoder.encode is inencode niya ang mismong word na "username" then concatenated with the equal sign symbol... then concatenated again with the actual username value.

so yung una po ay wala siyang pinaghuhugutan ng lakas... :)

So bale parang ganito:

[username=thisistheusername]
 
Yung "username" is yung name ng post, then yung walang double quote, yun yung value, naka declare yung variable na username, pwede din namang ganito.
Code:
String post_data = URLEncoder.encode("username","UTF-8") + "=" +URLEncoder.encode("MyUsername","UTF-8");

Bale pag kinuha mo sa php:
PHP:
$user = $_POST["username"];

ang magiging value ng $user variable ay "MyUsername"
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 431
    Views
  • 3
    Participants
Last reply from:
Mrkmrk

Trending Topics

Online now

Members online
1,119
Guests online
949
Total visitors
2,068

Forum statistics

Threads
2,278,649
Posts
28,984,877
Members
1,227,502
Latest member
johann1627
Back
Top