🔒 Closed Android string post

Status
Not open for further replies.

Netflix

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

Trending Topics

Online now

Members online
1,044
Guests online
8,612
Total visitors
9,656

Forum statistics

Threads
2,329,632
Posts
29,249,160
Members
1,154,546
Latest member
Assa22
Back
Top