Good, I have a problem with php, it's a vector form
<!DOCTYPE html>
<html lang="es">
<head>
<title>Ejercicio7.php - Vectores 2</title>
</head>
<body>
<?php
if ( isset ($_POST['vec']));
{
$vector =$_POST['vec'];
$n=count ($vector);
$suma=0;
echo "el vector tiene $n elementos <br>";
for ($i=0;$i<$n; $i++)
{
echo $i = $vector [$i]. "<br>";
$suma=$suma + $vector [$i];
}
echo " la suma es ".$suma . "<br";
}
?>
<form action="ejercicio7.php" method= "get">
Numero de Elementos :
<input type="text" name="n" size="5">
<input type="submit" value="Aceptar">
</form>
<br>
<br>
<form action="ejercicio7.php" method="post">
<?php
if (isset( $_GET['n']))
$n=$_GET['n'];
else
$n=3;
for($i=1;$i<=$n;$i++)
{
echo $i;
echo "<input type= 'text' name='vec[]' size='10'>";
}
?>
<input type="submit">
</form>
</body>
</html>
When I execute it I get this:
Notice: Undefined index: vec in C: \ xampp \ htdocs \ ExercisesPHP \ exercise7.php on line 10
the vector has 0 elements
I'm reviewing the code, but I can not find anything