title: How to call php file inside a form (html)
body: <p>I have 2 <strong>PHP</strong> files, called: </p>
  
  <ul>
  <li><strong>user_one.php</strong> -> returns a JSON with the info of One user (given by POST parameter)</li>
  <li><strong>user_uptade.php</strong> -> modify all fieds of One user (given by POST parameter) and returns a JSON with the modified data.</li>
  </ul>
  
  <p>Then I got 1 more file called, update_user.html where I want to:</p>
  
  <ol>
  <li>Call user_one.php</li>
  <li>take the JSON and put the info in the form of the update_user</li>
  <li>When User modifies his data, when he click accept button, user_update.php has to be called.</li>
  </ol>
  
  <p><code>What I want to know is how can I fill this form calling the user_one.php given the $_POST['user']</code>.</p>
  
  <p>*The user_one.php has to return a "echo json" because this file is called ina mobile phone request*</p>
  
  <p><strong>user_one.php (where the json is coded and returned)</strong></p>
  
  <pre><code>    &lt;?php
  
  /*
   * Following code will get single product details
   * A product is identified by product id (uid)
   */
  
  // array for JSON response
  $response = array();
  
  // include db connect class
  require_once __DIR__ . '../../db_connect.php';
  
  // connecting to db
  $db = new DB_CONNECT();
  // check for post data
  if (isset($_POST["user"])) {
      $uid = $_POST['user'];
      // get a product from products table
      $result = mysql_query("SELECT *FROM Usuarios WHERE Usuario = '$uid'");
  
      if (!empty($result)) {
          // check for empty result
          if (mysql_num_rows($result) &gt; 0) {
  
              $result = mysql_fetch_array($result);
  
              $users = array();
              $users["name"] = $result["Nombre"];
              $users["lastname"] = $result["Apellidos"];
              $users["user"] = $result["Usuario"];
              $users["password"] = $result["Contrasena"];
              $users["birthday"] = $result["Fnacimiento"];
              $users["direction"] = $result["Direccion"];
              $users["email"] = $result["Email"];
              $users["phone"] = $result["TelfFijo"];
              $users["mobile_phone"] = $result["TelfMov"];
              $users["user_type"] = $result["TipoUsuario"]; 
              // success
              $response["success"] = 1;
              // user node
              $response["user"] = array();
              // push single users into final response array
              array_push($response["user"], $users); 
              // echoing JSON response
              echo json_encode($response);
          } else {
              // no user found
              $response["success"] = 0;
              $response["message"] = "No user found";
  
              // echo no users JSON
              echo json_encode($response);
          }
      } else {
          // no user found
          $response["success"] = 0;
          $response["message"] = "No user found";
  
          // echo no users JSON
          echo json_encode($response);
      }
  } else {
      // required field is missing
      $response["success"] = 0;
      $response["message"] = "Required field(s) is missing";
  
      // echoing JSON response
      echo json_encode($response);
  }
  ?&gt;
  </code></pre>
  
  <p><strong>user_uptade.html (Where has to be filled the form with JSON obtained in user_one.php)</strong> </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt; 
  
  &lt;br&gt;Agregue un nuevo Usuario:
  
  &lt;form method="post" action="user_update.php" &gt;
  Nombre:
  &lt;br&gt;
  &lt;input type="Text" name="name" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Apellidos:
  &lt;br&gt;
  &lt;input type="Text" name="lastname" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Usuario:
  &lt;br&gt;
  &lt;input type="Text" name="user" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Fecha nacimiento:
  &lt;br&gt;
  &lt;input type="Text" name="bday" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Direccion:
  &lt;br&gt;
  &lt;input type="Text" name="direccion" &gt;
  &lt;br&gt;
  &lt;br&gt;
  TelFijo:
  &lt;br&gt;
  &lt;input type="Text" name="tfijo" &gt;
  &lt;br&gt;
  &lt;br&gt;
  TelMov:
  &lt;br&gt;
  &lt;input type="Text" name="tmov" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Email:
  &lt;br&gt;
  &lt;input type="Text" name="email" &gt;
  &lt;br&gt;
  &lt;br&gt;
  Password:&lt;br&gt;
  &lt;input type="password" name="password" &gt;&lt;br&gt;
  
  &lt;input type="Submit" name="enviar" value="Agregar"&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>