Foros del Web » Programando para Internet » PHP »

Problema para recoger datos de formulario (global $HTTP_POST_VARS)

Estas en el tema de Problema para recoger datos de formulario (global $HTTP_POST_VARS) en el foro de PHP en Foros del Web. Tengo un problema al ejecutar un codigo que me ha facilitado mi entidad bancaria para hacer la TPV virtual, ya que las variables de un ...
  #1 (permalink)  
Antiguo 26/11/2007, 04:06
 
Fecha de Ingreso: marzo-2007
Mensajes: 113
Antigüedad: 17 años, 1 mes
Puntos: 0
Problema para recoger datos de formulario (global $HTTP_POST_VARS)

Tengo un problema al ejecutar un codigo que me ha facilitado mi entidad bancaria para hacer la TPV virtual, ya que las variables de un formulario html que se le mandan al script php no le llegan y me temo que puede ser por "global $HTTP_POST_VARS;" aunque no se bien porque

Ya que no tienen soporte para este tipo de consultas por eso os pregunto a vosotros. A continuación os muestro del formulario y el script que me mandaron:

Codigo formulario html
Código PHP:
<html>
<
head><title>Empres</title></head>  
<
body>
   <
form name="form1" method="post" action="pago.php">
      <
table width="55%">
         <
tr>
            
      <
td colspan="2"> <h2>Empresa</h2>
            </
td>
         </
tr>
         <
tr>
            <
td>Titular: </td>
            <
td><input type="text" name="titular" value="titular"></td>
         </
tr>
         <
tr>
            <
td>Importe: </td>
            <
td><input type="text" name="importe"></td>
         </
tr>
         <
tr><td><input type="submit" value="Pagar"></td></tr>
      </
table>

   </
form>
</
body>
</
html
Codigo script php
Código PHP:
<?PHP
<?PHP
// If form is submitted with all required data then show the form
// else show error page
//$importe=230;
empty($Formulario) ?
     
ShowForm($importe,$titular):
     
ShowError();
exit;
?>

<?PHP
.......
.......
//Algoritmos de encriptacion


function ShowError () {
echo 
"<html><head><title>Results</title></head><body>
<table width=100% height=50%><tr><td>
<p><h2><center>Compruebe que todos los datos del formulario son correctos!!</center></h2></p>
</td></tr></table>
</body></html>\n"
;
# End of function ShowResults

function ShowForm ($importe,$titular) {
// Posted data
global $HTTP_POST_VARS;

// Now, print the HTML script
$url 'https://sis.sermepa.es/sis/realizarPago';
echo 
"<html><head><title>Comercio Simulador</title></head>
<body bgcolor=white>
<form name=form1 action=$url method=post>"
;
$order uniqid(1);
$order '1234' substr($order1,9);
$code 'codemio';
$currency '978';
$clave 'clavemia';  //
$importe $importe*100;
echo 
"
<input type=hidden name=Ds_Merchant_Amount value=$importe>
<input type=hidden name=Ds_Merchant_Titular value=$titular>
<input type=HIDDEN name=Ds_Merchant_ConsumerLanguage value=001>
<input type=HIDDEN name=Ds_Merchant_Currency value=$currency>
<input type=HIDDEN name=Ds_Merchant_Order value=$order>
<input type=HIDDEN name=Ds_Merchant_MerchantCode value=$code>
<input type=HIDDEN name=Ds_Merchant_Terminal value=001>
<input type=HIDDEN name=Ds_Merchant_ProductDescription>
<input type=HIDDEN name=Ds_Merchant_MerchantURL>
<input type=HIDDEN name=Ds_Merchant_MerchantName value=Empresa>"
//

// Compute hash to sign form data
// $signature=sha1_hex($importe,$order,$code,$currency,$clave);
$sha = new SHA;
$message $importe.$order.$code.$currency.$clave;
$digest1 $sha->hash_string($message);
$signature strtoupper ($sha->hash_to_string$digest1 ));

echo 
"<input type=hidden name=Ds_Merchant_MerchantSignature value='$signature'>
<center><script language=javascript>document.form1.submit();</script></center>
</form>
</body></html>"
;
# End of function ShowForm
?>
...
  #2 (permalink)  
Antiguo 26/11/2007, 05:55
Usuario no validado
 
Fecha de Ingreso: julio-2003
Ubicación: <?="www.tuky.cl";?>
Mensajes: 132
Antigüedad: 20 años, 9 meses
Puntos: 4
Re: Problema para recoger datos de formulario (global $HTTP_POST_VARS)

Hola!, primero. Para ser una entidad bancaria... poco saben de programación....

La variable $Formulario de dónde viene? siempre está vacía

Luego, si no tienes $HTTP_POST_VARS solo se cambiaría por $_POST.... y al llamar la función podrías hacerlo así

Código PHP:
if (isset($_POST['importe']) && isset($_POST['titular']))
     
ShowForm($_POST['importe'], $_POST['titular']);
else
     
ShowError();
exit; 

saludos!!

tuky.-
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:52.