Foros del Web » Programando para Internet » PHP »

Problema al ejecutar switch

Estas en el tema de Problema al ejecutar switch en el foro de PHP en Foros del Web. Hola a todos tengo un problema, en la parte final del codigo donde empieza el switch esa para del codigo no se ejecuta codigo php ...
  #1 (permalink)  
Antiguo 12/04/2011, 15:40
 
Fecha de Ingreso: enero-2005
Mensajes: 16
Antigüedad: 19 años, 4 meses
Puntos: 0
Problema al ejecutar switch

Hola a todos tengo un problema, en la parte final del codigo donde empieza el switch esa para del codigo no se ejecuta
codigo php
Código PHP:
<html>
<head>
<title>Formulario de pedido de libros</title>
</head>
<body>
<h1>Librer&iacute;a Online </h1>
<h2>Resumen del Pedido </h2>
<? 
   
echo "<p>Pedido procesado el "// Start printing order 
  
echo date("jS F, H:i ");
  echo 
"<br>";
  echo 
"<p>Su pedido es el siguiente:";
  echo 
"<br>";

  
$totalqty 0;

  
$totalamount 0.00;

  
define("ACTIONPRICE"100);

  
define("PHOTOPRICE"10);

  
define("FLASHPRICE"4);
  
  
$actionqty=$_POST["actionqty"];
  
  
$photoqty=$_POST["photoqty"];
  
  
$flashqty=$_POST["flashqty"];
     
   if( 
$actionqty 10// Menor que 10
  
$descuento 0;
  elseif( 
$actionqty >= 10 && $actionqty <= 49/* Colocamos el operdador and && es para poner dos condiciones */
  
$descuento 5;
  elseif (
$actionqty >= 50 && $actionqty <= 99// Igual o mayor y menor o igual
  
$descuento 10;
  elseif (
$actionqty 100)
  
$descuento 15;

  
$totalqty $actionqty $photoqty $flashqty;

  
$totalamount =  $actionqty ACTIONPRICE

                
$photoqty PHOTOPRICE

                
$flashqty FLASHPRICE;

 if( 
$totalqty == )

  {
    echo 
"<font color=red>"// Si se cumple el If ejecuta los 3 echos

    
echo "No ha introducido ninguna cantidad en el formulario<br>";

    echo 
"</font>";

  }

  else 

  {
          if(
$actionqty>0
    echo 
$actionqty." actionscript<br>";
        if(
$photoqty>0)
    echo 
$photoqty." photoshop<br>";
        if(
$flashqty>0)
    echo 
$flashqty." flash<br>";

  }
  
  echo 
"Su descuento es ".$descuento"%";
  switch (
$find)
  {
      case 
'a':
      echo 
"Soy un cliente habitual";
      break;
      case 
'b':
      echo 
"Anuncios de Televisión";
      break;
      case 
'c':
      echo 
"Informaciones en internet";
      break;
      case 
'd':
      echo 
"Me lo aconsejó un amigo";
      break;
     }
?>

</body>

</html>
Codigo html del formulario
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Documento sin título</title>
</head>

<body>
<form action="procesarorden.php" method="post" >
<table border=0>
<tr bgcolor=#cccccc>
  <td width=150><font face="Arial, Helvetica, sans-serif">Libro</font></td>
  <td width=15><font face="Arial, Helvetica, sans-serif">Cantidad</font></td>
</tr>
<tr>
  <td><font face="Arial, Helvetica, sans-serif">ActionScript</font></td>
  <td align=center><font face="Arial, Helvetica, sans-serif">
    <input type="text" name="actionqty" size=3 maxlength=3>
  </font></td>
</tr>
<tr>
  <td><font face="Arial, Helvetica, sans-serif">Photoshop</font></td>
  <td align=center><font face="Arial, Helvetica, sans-serif">
    <input type="text" name="photoqty" size=3 maxlength=3>
  </font></td>
</tr>
<tr>
  <td><font face="Arial, Helvetica, sans-serif">Flash MX </font></td>
  <td align=center><font face="Arial, Helvetica, sans-serif">
    <input type="text" name="flashqty" size=3 maxlength=3>
  </font></td>
</tr>
<tr>
  <td>¿Cómo conoció nuestra librería</td>
  <td><select name="find">
        <option value = "a">Soy un cliente habitual</option>
        <option value = "b">Anuncios de Televisión</option>
        <option value = "c">Informaciones en internet</option>
        <option value = "d">Me lo aconsejó un amigo</option>
      </select>
  </td>
</tr>
<tr>
  <td colspan=2 align=center><input type="submit" value="Enviar Pedido"></td>
</tr>
</table>
</form>
</body>
</html> 
  #2 (permalink)  
Antiguo 12/04/2011, 15:52
 
Fecha de Ingreso: enero-2005
Mensajes: 16
Antigüedad: 19 años, 4 meses
Puntos: 0
Respuesta: Problema al ejecutar switch

Solucionado

Etiquetas: switch
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 11:23.