Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/04/2013, 05:52
katoncin
 
Fecha de Ingreso: marzo-2013
Ubicación: cadiz
Mensajes: 30
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: necesito solucionar error Undefined index

Corregidos los errores que me habéis comentado.

Éstos son los errores que me da:

( ! ) Notice: Undefined variable: y in C:\wamp\www\yoteloenvio\nacional.php on line 54
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0

( ! ) Notice: Undefined index: tipo in C:\wamp\www\yoteloenvio\nacional.php on line 63
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0

( ! ) Notice: Undefined index: tipo in C:\wamp\www\yoteloenvio\nacional.php on line 80
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0

( ! ) Notice: Undefined index: distancia in C:\wamp\www\yoteloenvio\nacional.php on line 94
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0

( ! ) Notice: Undefined index: distancia in C:\wamp\www\yoteloenvio\nacional.php on line 103
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0

( ! ) Notice: Undefined index: tipo in C:\wamp\www\yoteloenvio\nacional.php on line 112
Call Stack
# Time Memory Function Location
1 0.0011 155752 {main}( ) ..\nacional.php:0
0

Gracias!

Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//ES"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>Envios Nacionales</title>
<link type="text/css" rel="stylesheet" href="style.css" />
<link type="text/css" rel="stylesheet" href="style-estructura.css" />


</head>

<body>
		<div id="header">
		<div id="info">
		<p><strong><font size="4">
		Si tiene alguna duda, contáctanos en: 675807799
		o escribenos a <a>[email protected]</a></strong>
		
		</p>
		</div>

<a href="index.html"><img src="imagenes/logo.png" width="639" height="152" longdesc="imagenes/logo.png">

		<ul id="menu"><font size="1"><strong>
        <li><a style="color:#3d4b54" href="index.html">Inicio</a></li> 
        <li><a style="color:#3d4b54" href="somos.html">Quiénes somos</a></li> 
        <li><a style="color:#3d4b54" href="servicios.html">Servicios</a></li>
        <li><a style="color:#3d4b54" href="Ayuda.html">Ayuda y Preguntas Frecuentes</a></li>
        <li><a style="color:#3d4b54" href="contacto.html">Contacto</a></li>
        <li><a style="color:#3d4b54" href="testimonios.html">Testimonios</a></li>
        <li><a style="color:#3d4b54" href="blog.html">Blog</a></li>
        
        </ul></font></strong>
		
		
				</div> 
Código PHP:
<?php
                

function calcular()
{
$alto$_POST['alto'];
$largo$_POST['largo'];
$ancho$_POST['ancho'];

$x$_POST['peso'];

$y=$alto+$largo+$ancho;

}

if (
$y<=100){
$precio=0;
$precioincremento 0;
}
elseif (
$y 100)
{
    
$precioincremento $y-100 0.1;
        
$precio $y-100 0.1;
}
if(
$_POST['tipo']=="sobre"){
          if(
$_POST['distancia']=="provincial"){
          
$precio+=4.50;}
                if(
$_POST['peso']>2){
                        
$_POST['total']="Lo sentimos. En esta opción el paquete no puede ser mayor a 2 kg, escoja la opción de paquetes mayores a 2 kg. Gracias.";}
         elseif(
$_POST['distancia']=="regional"){
             
$precio+=4.80;}
            if(
$_POST['PESO']>2){
                        
$precio="Lo sentimos. En esta opción el paquete no puede ser mayor a 2 kg, escoja la opción de paquetes mayores a 2 kg. Gracias.";}
        elseif(
$_POST['distancia']=="nacional"){
             
$precio+=5.50;}
            if(
$_POST['peso']>2){
                        
$precio="Lo sentimos. En esta opción el paquete no puede ser mayor a 2 kg, escoja la opción de paquetes mayores a 2 kg. Gracias.";}
                        }
                        
                        
/*$preciofinal = $precio + $precioincremento*/
                        
if ($_POST ['tipo']=="economico") {                        

//No tendría sentido el de X menor a 2, pero lo dejo de momento por si cambiaran los precios.
 
if($_POST['distancia']=="provincial"){
 
                                                         if (
$x<=2$precio+=4.50;
                                                        elseif (
$x<=&& $x>=2.1$precio+=4.60;
                                                        elseif (
$x<=10 && $x>=5.1$precio+=4.72;
                                                        elseif (
$x<=11 && $x>=10.1)$precio+=5.41;

}

}

if(
$_POST['distancia']=="regional"){
 
         if (
$x<=2$precio+=4.65;
        elseif (
$x<=&& $x>=2.1$precio+=4.70;
        elseif (
$x<=10 && $x>=5.1$precio+=4.90;
        elseif (
$x<=11 && $x>=10.1$precio+=5.61;

}

if(
$_POST['distancia']=="nacional"){
 
if (
$x<=2$precio+=4.65;
        elseif (
$x<=&& $x>=2.1$precio+=4.90;
        elseif (
$x<=10 && $x>=5.1$precio+=5.9;
        elseif (
$x<=11 && $x>=10.1$precio+=5.91;

}

if (
$_POST ['tipo']=="urgente") {                        


if (
$x<=2$precio+=4.65;
        elseif (
$x<=&& $x>=2.1$precio+=5.70;
        elseif (
$x<=10 && $x>=5.1$precio+=5.90;
        elseif (
$x<=11 && $x>=10.1$precio+=6.61;

}
$_POST['precio']=$precio;

echo 
$precio;
return

                        
?>
Código HTML:
				
<div id="envios">				
				
<ul id="menu"><font size=1>
        <li><img src="imagenes/tipoenvio2.png"></li> 
        <li><img src="imagenes/caracteristicas.png"></li> 
		<li><img src="imagenes/destino3.png"></li> 
        <li><img src="imagenes/pago3.png"></li> 
       
        
        </ul></font>
		<div id="tipo-envios-nacional">

<br>

<p><strong><font size= 4>Envíos Nacionales</p></strong></font>
		
		<p><font size=3> Selecciona el tipo de envío que más te interese <p></font><br/>

<p><font size=4><p><strong><font color="#f4800f">Envíos hasta 2kg.<p></font></font></strong>
<p><font size=3> Tu mejor opción para envíos de hasta 2 kg. Seguro incluido contra rotura y daños (hasta 6.000 € cubiertos). Envíos en 24 horas. Lo recogemos el mismo día, antes de las 7 de la tarde y lo entregamos el día siguiente antes de la misma hora.
</font>


<br>
<br>

<p><font size=4><p><strong><font color="#f4800f">Mismo Día<p></font></font></strong>
<p><font size=3>  ¿Tienes una entrega que no puede esperar hasta mañana, y quieres que se entregue hoy mismo? Con este servicio no tendrás que esperar.
</font>
</p>


<br>

<p><font size=4><p><strong><font color="#f4800f">Urgente 24 HORAS<p></font></font></strong>
<p><font size=3>  Envíos urgentes para a cualquier punto de España, para bultos mayores de 2 kilogramos.</p> 
</font>
</p>


<br>

<p><font size=4><p><strong><font color="#f4800f">Económico 48-72 HORAS<p></font></font></strong> 
<p> Si tu prioridad no es el tiempo de entrega. Éste es tu servicio más barato.
</p>

</div>

<div id="peso-volumen">

<form name="formulario" action="calculadora.php" method="post">

<tr>
   <td><label>Peso (Kg):</label></td>
   <td><input type="text" name="peso" maxlength="3" size="3" onchange="return calcular"()></td><br>
   <td><label>Alto (cm):</label></td>
   <td><input type="text" name="alto" maxlength="3"size="3"></td><br>
   <td><label>Largo (cm):</label></td>
   <td><input type="text" name="largo" maxlength="3"size="3"></td><br>
   <td><label>Ancho (cm):</label></td>
   <td><input type="text" name="ancho" maxlength="3"size="3"></td><br>



<br><br>
   <td><select name="tipo"><option value="sobre">paquetes hasta 2 kg </option>
   <option value="economico">envío económico para paquetes mayores a 2 kg</option>
   <option value="urgente">envíos urgentes</option></td>
   </select><br>
   <td><select name="distancia"><option value="provincial">provincial</option>
   <option value="regional">regional</option>
   <option value="nacional">nacional</option></td>
   
<input type="submit" name="submit" value="Precio" />   
<input type="text" name="precio" size="3">

</tr>

</div>	

<a href="nacional-datos.html"><p><h1>ENVÍAMELO</h1></p></a>

				</div>




				
	<div id="footer">
		
		<ul id="menu2">
        <strong><li><a style="color:#f4800f" href="nacional.php">Envíos Nacionales</a></li>
        <li><a style="color:#f4800f" href="internacional.php">Envíos Internacionales</a></li>  
        <li><a style="color:#f4800f" href="condiciones.html">Términos y condiciones</a></li>
        <li><a style="color:#f4800f" href="privacidad.html">Politica de privacidad</a></li>
        <li><a style="color:#f4800f" href="mapa.html">Mapa del sitio</a></li><br>
        <li><a style="color:#f4800f" href="cookies.html">Uso de cookies</a></li>
        <li><a style="color:#f4800f" href="prohibidos.html">Artículos prohibidos</a></li>
		<li><a style="color:#f4800f" href="necesidad.html">¿Qué necesito?</a></li></strong>
        
        </ul>
		
		<hr/><br>
		
		<p class="derechos"><align=center> © Yoteloenvio.com 2013 todos los derechos reservados<br>
		Yoteloenvio.com Calle Carraca nº15, San Fernando (Cadiz) 11100<br>
		contáctenos en: [email protected] Telefono: 675807799. Marca registrada en España<br><br>
		<img src="imagenes/tiposdepago.jpg"> Siguenos en <img src="imagenes/twitter.gif"> <img src="imagenes/facebook.gif">

		</p>

		
		</div>		
					
				
				
</body>

</html>