title: How to store data in mysql from ios app using php?
body: <p>I want to save user registration detail from my ios app (using swift 3) in MySQL using PHP. But it's not working. 
  Here is my code:    </p>
  
  <p><strong>registeruser.php</strong></p>
  
  <pre><code>$response = array ();
      if ($_SERVER ['REQUEST_METHOD'] == 'POST') {
      // getting values
      $username = $_POST ["username"];
      $password = $_POST ['password'];
      // including the db operation file
      require_once '../include/DbOperation.php';
      // inserting values
      if ($db-&gt;createUser($username, $password)) {
          $response ['error'] = false;
          $response ['message'] = 'user added successfully';
      } else {
          $response ['error'] = true;
          $response ['message'] = ' user not added';
      }
  echo json_encode ( $response );
   public function createUser($username, $password)
      {
  $stmt = $this-&gt;conn-&gt;prepare("INSERT INTO registerUser(username, password) values(?, ?)");
          $stmt-&gt;bind_param("register", $username, $password);  
          $result = $stmt-&gt;execute();
          $stmt-&gt;close();
          echo $result;
          if ($result) {
              return true;
          } else {
              return false;
          }
      }
  </code></pre>
  
  <p>I don't know why it's not working? </p>
  
  <p>the <strong>error</strong> shown is </p>
  
  <blockquote>
    <p>Undefined index: Username and password.</p>
  </blockquote>