title: Submitting PHP form after http post in AngularJS
body: <p>I'm trying to integrate a bank payment solution to my angularJS app.</p>
  
  <p>By default the bank solution comes with a PHP document that includes a form. I've managed to make a http.post call from my angularJS app including the total price of the order, but the PHP document returns the form instead of submitting it.</p>
  
  <p>I'm not good at all with PHP, I'm sure I'm missing something super basic but I don't see what.</p>
  
  <p>Here's my http call:</p>
  
  <pre><code>$scope.sabadell = function(){
    $scope.pago = {
      'total':$scope.total
    }
    var $promise=$http.post('sabadell/pago.php',$scope.pago); 
  
    $promise.then(function (data) {
      console.log(data);
    });
  };
  </code></pre>
  
  <p>And the PHP doc:</p>
  
  <pre><code>&lt;?php
  
      $contentType = explode(';', $_SERVER['CONTENT_TYPE']); 
      $rawBody = file_get_contents("php://input");
  
      $data = array(); 
  
      if(in_array('application/json', $contentType)) { 
        $data = json_decode($rawBody);
        $total = $data-&gt;total;
      } else {
        parse_str($data, $data); 
      }
  
      include 'apiRedsys.php';
  
      $miObj = new RedsysAPI;
  
      // Valores de entrada
      $merchantCode   ="xxx";
      $terminal       ="1";
      $amount         =$total;
      $currency       ="978";
      $transactionType ="0";
      $merchantURL    =""; 
      $urlOK          =""; 
      $urlKO          =""; 
      $order          =time();
  
      $urlPago = "https://sis-t.redsys.es:25443/sis/realizarPago";
  
      $miObj-&gt;setParameter("DS_MERCHANT_AMOUNT",$amount);
      $miObj-&gt;setParameter("DS_MERCHANT_ORDER",strval($order));
      $miObj-&gt;setParameter("DS_MERCHANT_MERCHANTCODE",$merchantCode);
      (...)
  
      $version="HMAC_SHA256_V1";
      $key = 'xxx';
  
      $request = "";
      $params = $miObj-&gt;createMerchantParameters();
      $signature = $miObj-&gt;createMerchantSignature($key);
  
  ?&gt;
  &lt;html lang="es"&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form name="frm" action=" &lt;?php echo $urlPago ?&gt;" method="POST" target="_blank" id="sabadell"&gt;
  Ds_Merchant_SignatureVersion &lt;input type="text" name="Ds_SignatureVersion" value="&lt;?php echo $version; ?&gt;"/&gt;&lt;/br&gt;
  Ds_Merchant_MerchantParameters &lt;input type="text" name="Ds_MerchantParameters" value="&lt;?php echo $params; ?&gt;"/&gt;&lt;/br&gt;
  Ds_Merchant_Signature &lt;input type="text" name="Ds_Signature" value="&lt;?php echo $signature; ?&gt;" /&gt;&lt;/br&gt;
  &lt;input type="submit" value="Enviar" &gt;
  &lt;/form&gt;
  
  &lt;script type="text/javascript"&gt;
      document.getElementById('sabadell').submit(); // SUBMIT FORM
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How could I manage to trigger this form and thus redirecting the user to the desired payment solution website?</p>