ALGUIEN ME PODRIA AYUDAR POR FAVOR SE TIENE QUE HACER EN PHP -SUBLIME POR FAVOR .
Publicado por Rey (2 intervenciones) el 27/05/2020 22:44:14


Valora esta pregunta


-1
<?php
//define(d1,0.3);
//define(d2,0.2);
//define(d3,0.15);
//define(d4,0.1);
$c=0; $m_d=0;
if(isset($_POST["btnCalcular"])){
$c=(float)$_POST["txtc"];
if ($c>100) {
$m_d=$c*d1;
}else if ($c>60) {
$m_d=$c*d2;
}else
if ($c>30) {
$m_d=$c*d3;
}else{
$m_d=$c*d4;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css"></style>
</head>
<body>
<form method="post" action="EJEMPLO1.php">
<table width="273" border="0">
<tr>
<td colspan="2"><strong>EJEMPLO1</strong></td>
</tr>
<tr>
<td width="75">consumo</td>
<td width="151">
<input name="txtc" type="text" id="textc" value="<?=$c?>"/>
</td>
</tr>
<tr>
<td>Monto Descuento</td>
<td><input name="textm_d" type="text" class="textofondo" id="textm_d" value="<?=$m_d?>"></td>
</tr>
<tr>
<td>Inpuesto IGV</td>
<td><input name="textm_igv" type="text" class="textofondo" id="textm_igv" value="<?=$m_igv?>"></td>
</tr>
<tr>
<td>Importe a pagar</td>
<td><input name="txtp" type="text" class="textofondo" id="textp" value="<?=$p?>"></td>
</tr>
<tr>
<td> </td>
<td>
<input name="btnCalcular" type="submit" id="btnCalcular" value="Calcular"/></td>
</tr>
</table>
</form>
</body>
</html>