PHP - Ayuda en PHP relacionado al Radio Button

Filtrado por el usuario: xve
Filtrado por el usuario 'xve' (Eliminar fitro)
 
Vista:
sin imagen de perfil

Ayuda en PHP relacionado al Radio Button

Publicado por Camilo Ortiz (5 intervenciones) el 27/01/2015 19:14:08
Buenas tardes, agradezco a quien me pueda colaborar con este tema, la cuestión es la siguiente:

Necesito que al seleccionar un radio button de un grupo el cual hay tres con valores diferentes cada uno (6000, 20000, 50000), y luego al hacer click en el boton enviar, me aparezca en algún sitio de la página (eso ya lo tengo claro) un texto y un botón todos diferentes dependiendo de cual radio button seleccione, tengo un codigo pero no he podido lograr que funcione, siempre me llama los tres textos diferentes al mismo tiempo. No soy muy experto en PHP por lo cual tengo lo siguiente:

Tengo un archivo Index.php y otro archivo enviar.php, en Index tengo lo siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<form name="envio" id="envio" method="post" action="#">
    <div><?php include( 'enviar.php' ); ?>
        <div class="cantidad_pago">
            <input type="radio" name="pagos" value="6000" id="pago6000">
            <label id="pago6000" for="pago6000"></label>
 
            <input type="radio" name="pagos" value="20000" id="pago20000">
            <label id="pago20000" for="pago20000"></label>
 
            <input type="radio" name="pagos" value="50000" id="pago50000">
            <label id="pago50000" for="pago50000"></label>
        </div>
        <div class="dialog_actions">
            <input class="fleft mright10 br3 sbutton sbutton_small sbutton1" id="enviar" name="enviar" value="Enviar" type="submit">
</form>

En el archivo enviar tengo lo siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
 
if($_POST['enviar']){
 
$pagos = $_POST['pagos'];
 
$mensaje6000 .='

<div>
<p class="small mbottom10"><a>Se ha enviado la Programación exitosamente...</a></p>

<p class="small mbottom10"><a>Importante: Por favor realice el pago lo más pronto posible a traves de nuestras cuentas bancarias enviadas a través de email.</a></p>

<p class="small mbottom10"><a><form method="post" action="https://gateway.payulatam.com/ppp-web-gateway/pb.zul" accept-charset="UTF-8">
<input type="image" border="0" alt="" src="http://www.payulatam.com/img_botones_herramientas/boton_pagar_pequeno.png" onClick="this.form.urlOrigen.value = window.location.href;"/>
<input name="merchantId" type="hidden" value="501506"/>
<input name="accountId" type="hidden" value="502306"/>
<input name="description" type="hidden" value="Programación Combinada"/>
<input name="referenceCode" type="hidden" value="PC"/>
<input name="amount" type="hidden" value="6000"/>
<input name="tax" type="hidden" value="0"/>
<input name="taxReturnBase" type="hidden" value="0"/>
<input name="shipmentValue" value="0" type="hidden"/>
<input name="currency" type="hidden" value="COP"/>
<input name="lng" type="hidden" value="es"/>
<input name="sourceUrl" id="urlOrigen" value="" type="hidden"/>
<input name="buttonType" value="SIMPLE" type="hidden"/>
<input name="signature" value="8e022f4dfdf14629c3067e4a99826d803f1a44baa1c83214fb7ee906de54411b" type="hidden"/>
</form></a></p>
</div>
';
 
$mensaje20000 .='
<div>
<p class="small mbottom10"><a>Se ha enviado la Programación exitosamente...</a></p>

<p class="small mbottom10"><a>Importante: Por favor realice el pago lo más pronto posible a traves de nuestras cuentas bancarias enviadas a través de email.</a></p>


<p class="small mbottom10"><a><form method="post" action="https://gateway.payulatam.com/ppp-web-gateway/pb.zul" accept-charset="UTF-8">
<input type="image" border="0" alt="" src="http://www.payulatam.com/img_botones_herramientas/boton_pagar_pequeno.png" onClick="this.form.urlOrigen.value = window.location.href;"/>
<input name="merchantId" type="hidden" value="501506"/>
<input name="accountId" type="hidden" value="502306"/>
<input name="description" type="hidden" value="Programación Sencilla"/>
<input name="referenceCode" type="hidden" value="PS"/>
<input name="amount" type="hidden" value="20000"/>
<input name="tax" type="hidden" value="0"/>
<input name="taxReturnBase" type="hidden" value="0"/>
<input name="shipmentValue" value="0" type="hidden"/>
<input name="currency" type="hidden" value="COP"/>
<input name="lng" type="hidden" value="es"/>
<input name="sourceUrl" id="urlOrigen" value="" type="hidden"/>
<input name="buttonType" value="SIMPLE" type="hidden"/>
<input name="signature" value="db870a851dbd3a78658f5eceaf3801084d3b726b3c03bae2bf04704999e5d0e2" type="hidden"/>
</form></a></p></div>
';
 
$mensaje50000 .='
<div>
<p class="small mbottom10"><a>Se ha enviado la Programación exitosamente...</a></p>

<p class="small mbottom10"><a>Importante: Por favor realice el pago lo más pronto posible a traves de nuestras cuentas bancarias enviadas a través de email.</a></p>


<p class="small mbottom10"><a><form method="post" action="https://gateway.payulatam.com/ppp-web-gateway/pb.zul" accept-charset="UTF-8">
<input type="image" border="0" alt="" src="http://www.payulatam.com/img_botones_herramientas/boton_pagar_pequeno.png" onClick="this.form.urlOrigen.value = window.location.href;"/>
<input name="merchantId" type="hidden" value="501506"/>
<input name="accountId" type="hidden" value="502306"/>
<input name="description" type="hidden" value="Programación Doble"/>
<input name="referenceCode" type="hidden" value="PD"/>
<input name="amount" type="hidden" value="50000"/>
<input name="tax" type="hidden" value="0"/>
<input name="taxReturnBase" type="hidden" value="0"/>
<input name="shipmentValue" value="0" type="hidden"/>
<input name="currency" type="hidden" value="COP"/>
<input name="lng" type="hidden" value="es"/>
<input name="sourceUrl" id="urlOrigen" value="" type="hidden"/>
<input name="buttonType" value="SIMPLE" type="hidden"/>
<input name="signature" value="6df74813621b822b57fa8940bab8006fa1ee11c32da8449c16dce080686e243a" type="hidden"/>
</form></a></p></div>
';
 
	  if ($pagos = '6000') {
 
         echo "$mensaje6000";
 
      }else{
 
		  echo " ";
 
		  }
 
	  if ($pagos = '20000') {
 
            echo "$mensaje20000";
 
      }
 
	  else{
 
		  echo " ";
 
		  }
 
	  if ($pagos = '50000') {
 
            echo "$mensaje50000";
 
      }
	  else{
 
		  echo " ";
 
		  }
}
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Ayuda en PHP relacionado al Radio Button

Publicado por xve (6935 intervenciones) el 27/01/2015 20:08:21
Hola Camilo, en los condicionales, si utilizas un solo signo igual, estas asigando... para comparar, tienes que poner dos sigunos de igualdad...

1
2
if($pagos=="6000")
...

coméntanos, ok?

NOTA: Te recomiendo que revises tu código, ya que tienes <div> sin cerrar.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Ayuda en PHP relacionado al Radio Button

Publicado por Camilo Ortiz (5 intervenciones) el 27/01/2015 20:20:34
Perfecto, muchas gracias, funciona ok, respecto a las div voy a revisar gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar