title: PHP POST not received from Android using Volley library
body: <p>I made a post request with the following code in Android using Volley.</p>
  
  <pre><code>JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Method.POST, ServerURL.URL_REGISTER, new Response.Listener&lt;JSONObject&gt;() {
  
      @Override
      public void onResponse(JSONObject response) {
          Log.d(TAG_REGISTER, "Register Response: " + response.toString());
          pDialog.dismiss();
  
          try {
              JSONObject jObj = new JSONObject(response.toString());
              boolean error = jObj.getBoolean("error");
              if (!error) {
                  // User successfully stored in MySQL
                  // Now store the user in sqlite
                  String uid = jObj.getString("uid");
  
                  JSONObject user = jObj.getJSONObject("user");
                  String name = user.getString("name");
                  String email = user.getString("email");
                  String created_at = user
                          .getString("created_at");
  
                  // Inserting row in users table
                  db.addUserIntoSQLite(name, email, uid, created_at);
  
                  Toast.makeText(getActivity(), "User successfully registered. Try login now!", Toast.LENGTH_LONG).show();
  
                  // Launch main activity
                  Intent intent = new Intent(getActivity(), MainActivity.class);
                  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                  getActivity().overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
                  startActivity(intent);
                  getActivity().finish();
  
              } else {
  
                  // Error occurred in registration. Get the error
                  // message
                  String errorMsg = jObj.getString("error_msg");
                  Toast.makeText(getActivity(), errorMsg, Toast.LENGTH_LONG).show();
              }
          } catch (JSONException e) {
              Toast.makeText(getActivity(), "JSONException: " + e.getMessage(), Toast.LENGTH_LONG).show();
          }
  
      }
  }, new Response.ErrorListener() {
  
      @Override
      public void onErrorResponse(VolleyError error) {
          Log.e(TAG_REGISTER, "Registration Error: " + error.getMessage());
          Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_LONG).show();
          pDialog.dismiss();
      }
  }) {
  
      @Override
      public String getBodyContentType() {
          return "application/json; charset=utf-8";
      }
  
      @Override
      protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
          HashMap&lt;String, String&gt; params = new HashMap&lt;&gt;();
          params.put("tag", "register");
          params.put("name", name);
          params.put("email", email);
          params.put("password", password);
          return params;
      }
  };
  </code></pre>
  
  <p>Now here's the PHP part that receives the post request and get the post values.</p>
  
  <pre><code>&lt;?php
  session_start();
  
  if (!empty($_POST['tag'])) {
  
      // get tag
      $tag = $_POST['tag'];
  
      // include db handler
      require_once 'mysql/DB_Functions.php';
      $db = new DB_Functions();
  
      // response Array
      $response = array("tag" =&gt; $tag, "error" =&gt; FALSE);
  
      // check for tag type
      if ($tag == 'login') {
          // Request type is check Login
          $email = $_POST['email'];
          $password = $_POST['password'];
  
          // check for user
          $user = $db-&gt;getUserByEmailAndPassword($email, $password);
          if ($user != false) {
              // user found
              $response["error"] = FALSE;
              $response["uid"] = $user["unique_id"];
              $response["user"]["name"] = $user["name"];
              $response["user"]["email"] = $user["email"];
              $response["user"]["created_at"] = $user["created_at"];
              $response["user"]["updated_at"] = $user["updated_at"];
              echo json_encode($response);
          } else {
              // user not found
              // echo json with error = 1
              $response["error"] = TRUE;
              $response["error_msg"] = "Incorrect email or password!";
              echo json_encode($response);
          }
      } else if ($tag == 'register') {
          // Request type is Register new user
          $name = $_POST['name'];
          $email = $_POST['email'];
          $password = $_POST['password'];
  
          // check if user is already existed
          if ($db-&gt;userExists($email)) {
              // user is already existed - error response
              $response["error"] = TRUE;
              $response["error_msg"] = "User already exists";
              echo json_encode($response);
          } else {
              // store user
              $user = $db-&gt;storeUser($name, $email, $password);
              if ($user) {
                  // user stored successfully
                  $response["error"] = FALSE;
                  $response["uid"] = $user["unique_id"];
                  $response["user"]["name"] = $user["name"];
                  $response["user"]["email"] = $user["email"];
                  $response["user"]["created_at"] = $user["created_at"];
                  $response["user"]["updated_at"] = $user["updated_at"];
                  echo json_encode($response);
              } else {
                  // user failed to store
                  $response["error"] = TRUE;
                  $response["error_msg"] = "Error occured in Registartion";
                  echo json_encode($response);
              }
          }
      } else {
          // user failed to store
          $response["error"] = TRUE;
          $response["error_msg"] = "Unknow 'tag' value. It should be either 'login' or 'register'";
          echo json_encode($response);
      }
  } else {
      $response["error"] = TRUE;
      $response["error_msg"] = "Operation failed due to the missing tag!";
      echo json_encode($response);
  }
  
  var_dump($_SERVER['REQUEST_METHOD'], $_POST);
  ?&gt;
  </code></pre>
  
  <p>I should be able to get the 'tag' value, but the problem is that it keeps saying that the 'tag' is missing. </p>
  
  <p>So now I created an HTML file to test which part has a problem.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="index.php" method="post"&gt;
  Tag: &lt;input type="text" name="tag"&gt;&lt;br&gt;
  Name: &lt;input type="text" name="name"&gt;&lt;br&gt;
  Email: &lt;input type="text" name="email"&gt;&lt;br&gt;
  Password: &lt;input type="password" name="password"&gt;&lt;br&gt;
  &lt;input type="submit"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As I put the data in this HTML file, the data is successfully stored in the MySQL database. Which part do you think has the problem?</p>
  
  <p>I've searched all the solutions regarding the Volley part, and my Volley part doesn't seem to have the problem. So I believe it's the PHP part that's causing the issue.</p>
  
  <p>If I open the PHP file on the web, it shows the following message.</p>
  
  <pre><code>{"error":true,"error_msg":"Operation failed due to the missing tag!"}string(3) "GET" array(0) { }
  </code></pre>