Dear good morning.
How can I request a data in php (after clicking on the submit button?).
I have the following initial formula where I ask for "Product Code", "Quantity" and the submit button.
<?php
header('Content-type: text/html; charset=utf-8');
$retVal = '
<html>
<head>
<style>
body{
background: #004B85;
}
</style>
<form action="resultados.php" method="get">
<center>
<table border="3" bgcolor=white>
<tr>
<td align= "right">
Código:
</td>
<td>
<input type="date" name="selCodigo" required="required"/>
</td>
<td align= "right">
Cantidad:
</td>
<td>
<input type="date" name="cantidad" required="required"/>
</td>
</tr>
</table>
<input type="submit" value="Calcular">
</center>
</form>
</head>
</html>';
echo $retVal;
?>
By clicking on the submint button, you execute the calculations but only a few products have several release percentages.
The code of the file resultados.php that I need to complete is more or less like this:
<?php
$selCodigo = $_GET(selCodigo);
$libera = mysql_query('SELECT porcentaje FROM liberaciones WHERE codigo = "'.$selCodigo.'" ;');
$numDatos = mysql_num_rows($libera);
switch (TRUE){
case ($numDatos > 1):
// (Esta es la parte que no se cómo haerlo)
// El producto tiene "Varios" porcentajes de liberaciones
// y debe desplegar (por ejemplo una ventana modal)
// con los porcentajes de liberación para que el
// usuario escoja.
//
// El 0.10 por ciento de los productos tienen este problema
$porcenLibAdv = "El porcentaje que escoje el usuario";
case ($numDatos == 1):
// El producto solo tiene un único porcentaje liberatorio, aquí no hay problema.
// El 9.9 por ciento de los productos tienen un valor liberatorio
$liberaArray = mysql_fetch_array($libera);
$porcenLibAdv = $liberaArray['porcentaje'];
default:
// No hay porcentaje liberatorio, aquí tampoco hay problema.
// El 90 por ciento de los productos no tienen liberación
$porcenLibAdv = 0;
}
$resultado = $valor * $porcenLibAdv;
?>
Is there a way to ask for that data in resultados.php? or necessarily the user has to enter it in inicial.php?