I'm trying to do a simple PHP processing and I get the following error:
Notice: Undefined index: payment1 in C: \ xampp \ htdocs \ actividadangel2 \ activity.php on line 38
Notice: Undefined index: payment1 in C: \ xampp \ htdocs \ actividadangel2 \ activity.php on line 45
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<td><img src="001-corn.png"></td>
<td>Maíz</td>
<td><input action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" type="number" name="valorneto" placeholder="Introduzca el monto"></td>
<td>
<select id="metodo_de_pago" name="pago1">
<option value="E">Efectivo</option>
<option value="T">Tarjeta</option>
</select>
</td>
<td>
<?php
if ($_POST["pago1"]=="E")
{
$valorneto = ($_POST['valorneto']);
$sumaE = (int)$valorneto + ((((int)$valorneto * 16))/100); #Nota: Se solventó el problema de "non-numeric value" con (int).
echo $sumaE ." " ."Petros";
}
else {
if ($_POST["pago1"]=="T")
{
$valorneto = ($_POST['valorneto']);
$sumaT = (int)$valorneto+((((int)$valorneto)*(10))/100);
echo $sumaT;
}
}
if (!empty($_POST['valorneto'])) {
echo " ";
}
?>
</td>
</form>
</tr>
<tr>
<td style="align-content: center;">
<input type="submit" name=" operar">
</td>
</tr>
The lines in question are:
38 = if ($ _POST ["payment1"] == "E")
45 = if ($ _POST ["payment1"] == "T")