🔒 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
  • 443
    Views
  • 3
    Participants
Last reply from:
Mrkmrk

Trending Topics

Online now

Members online
793
Guests online
3,456
Total visitors
4,249

Forum statistics

Threads
2,306,519
Posts
29,172,313
Members
1,193,911
Latest member
duplo12
Back
Top