Código HTML:
Ver original
<html> <head> <meta charset="UTF-8"/> <!--<link rel="stylesheet" type="text/css" href="style.css" />--> <script type="text/javascript"> function toggle(elemento) { if(elemento.value=="h") { document.getElementById("hombre").style.display = "block"; document.getElementById("mujer").style.display = "none"; }else{ if(elemento.value=="m") { document.getElementById("hombre").style.display = "none"; document.getElementById("mujer").style.display = "block"; } } } </script> <script type="text/javascript"> $(document).ready(function() { $("#boton").click(function () { alert($('input:radio[name=genero]:checked').val()); $("#formulario").submit(); }); }); </script> </head> <body> <!--<div id="contenedor">--> <!--<div id="marco">--> <form method="POST" action="index.php"> <center><input type="submit" name="enviar" value="Calcular"></center> </form> <!--</div>--> <!--</div>--> </body> </html>
Código PHP:
Ver original
<?php @$p = $_POST['peso']; @$est = $_POST['estatura']; @$g2 = $_POST['genero']; @$u = $_POST['uno']; @$d = $_POST['dos']; @$t = $_POST['tres']; @$c = $_POST['cuatro']; @$cin = $_POST['cinco']; @$s = $_POST['seis']; @$si = $_POST['siete']; @$o = $_POST['ocho']; @$n = $_POST['nueve']; @$d = $_POST['diez']; @$on = $_POST['once']; @$do = $_POST['doce']; @$tr = $_POST['trece']; @$ca = $_POST['catorce']; @$q = $_POST['quince']; @$di = $_POST['diecises']; @$ds = $_POST['diecisiete']; @$do = $_POST['dieciocho']; @$dn = $_POST['diecinueve']; @$v = $_POST['veinte']; @$vu = $_POST['veintiuno']; @$vd = $_POST['veintidos']; @$vt = $_POST['veintitres']; @$vc = $_POST['veinticuatro']; @$vco = $_POST['veinticinco']; @$vs = $_POST['veintiseis']; @$vsi = $_POST['veintisiete']; @$vo = $_POST['veintiocho']; echo "Tu IMC es: $IMC"; if($IMC<12.1){$escala="Desnutricion Severa";} if(($IMC>=12.2)&&($IMC<12.9)){$escala="Desnutricion Moderada";} if(($IMC>=13)&&($IMC<16.7)){$escala="Normal";} if(($IMC>=16.8)&&($IMC<18.4)){$escala="Sobrepeso";} if($IMC>=18.5){$escala="Obesidad";} echo "<br>Tu escala es: $escala"; ?>