Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/06/2015, 10:22
AsturieshXc
 
Fecha de Ingreso: junio-2015
Ubicación: Mieres
Mensajes: 4
Antigüedad: 8 años, 10 meses
Puntos: 0
Respuesta: Aplicaciones web

Más o menos sería algo así el primero:

ahi el formulario
Código:
<html>
<head></head>
<body>
<form name="calcular_entrada" method="POST" action="calc_entrada.php">
<p>Entrada:  Carros chocones <input type="radio" name="atraccion" value="10"> Monta&ntilde;a rusa <input type="radio" name="atraccion" value="12"> Barco pirata <input type="radio" name="atraccion" value="8">

<p>Edad: Adulto<input type="radio" name="edad" value="adulto">  Ni&ntilde;o<input type="radio" name="edad" value="crio"></p>

<p>Descuento <input type="checkbox" name="descuento" value="1">

<input type="submit" value="Calcular">

</form>


</body>

y aquí el calc_entrada.php

Código PHP:
<html>
<head></head>
<body>
<?php
$atraccion
=$_POST["atraccion"];
$edad=$_POST["edad"];





if(
$edad=="adulto")
{
    
$precio=$atraccion;
}
else
{
    
$precio=$atraccion/2;
}
if(!empty(
$descuento))
{

    
    
$valorDesc=$precio/10;

}
else
{
    
$valorDesc=0;
}

$precioDes=$precio-$valorDesc;
echo(
"COSTO DEL TICKET: ".$precio."$<br>");
echo(
"DESCUENTO: ".$valorDesc."$<br>");
echo(
"PRECIO CON DESCUENTO: ".$precioDes."$");
?>
</body>

Última edición por AsturieshXc; 11/06/2015 a las 10:28