Por qué me da error de arreglo cuando no es arreglo ?
Publicado por Mateo (1 intervención) el 30/03/2021 02:45:19
Aqui esta un ejemplo del código, al ejecutarlo va todo bien, sin embargo, me da el siguiente error:
Warning: Undefined array key "radio" in .......(ruta)........ on line 14.
Warning: Undefined array key "radio" in .......(ruta)........ on line 14.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html>
<body>
<form action="prueba.php" method="POST">
<label for="">Nivel de profesion</label><br>
<input type="radio" name="radio" value="basico">Básico
<input type="radio" name="radio" value="intermedio">Intermedio
<input type="radio" name="radio" value="pro">Profesional<br>
<br><input type="submit" name="submit"><br>
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$radio = $_POST['radio'];
if(empty($radio)){
echo "<li> Debe seleccionar un nivel de profesión.</li><br>";
}
}
?>
Valora esta pregunta


0