Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/03/2013, 16:26
NekoDan
 
Fecha de Ingreso: marzo-2013
Mensajes: 1
Antigüedad: 11 años, 1 mes
Puntos: 0
Notificación PHP - Notice: Undefined index

Hola a todos!

Soy nuevo en PHP y tengo el siguiente caso, estoy haciendo un formulario PHP básico en el cual se va a realizar una sencilla operación de multiplicación. El código es el siguiente:

<body>
<form name="form1" method="post" action="test.php">
Valor 1: <input name="mult1" type="text" /><br />
Valor 2: <input name="mult2" type="text" /><br />
Valor 3: <input name="mult3" type="text" /> <br />
<input type="submit" name="Submit" value="Multiplicar" /> <br /><br />
</form>
<br />
<br />
Total:
<?php
// Check: http://notesofgenius.com/how-fix-php-notice-undefined-index/
$mult1 = $_POST['mult1'];
$mult2 = $_POST['mult2'];
$mult3 = $_POST['mult3'];

$multiplicar = $mult1 * $mult2 * $mult3;
echo $multiplicar;
?>
</body>

Sin embargo al probarlo me aparecen 3 mensajes con lo siguiente:

Notice: Undefined index: mult1 in C:\wamp\www\test.php on line 20
Notice: Undefined index: mult2 in C:\wamp\www\test.php on line 21
Notice: Undefined index: mult3 in C:\wamp\www\test.php on line 22

Quisiera saber como puedo solucionar este problema.

Agradeceré su respuesta.