Formulario:
Código HTML:
<form name="form1" method="post" action="cot_results.php"> <table width="50%" align="center"> <tr> <td width="13%" class="body_text_">Nombre:</td> <td width="39%"> <input name="name" type="text" class="main" id="name"></td> <td width="11%" class="body_text_">Teléfono</td> <td width="6%"><input name="phone" type="text" class="main" id="phone"></td> <td width="31%"><span class="body_text_">Edad:</span></td> <td width="31%"><input name="age" type="text" class="main" id="age" size="5" maxlength="2"></td> <td width="31%"><input name="Submit" type="submit" class="main" value="Enviar"></td> </tr> </table> </form>
Código PHP:
if ('$age<=18')
printf("
<table align=center>\n
<tr>\n
<td><div class='body_text_'>$name</div></td>\n
<td><div class='body_text'>de acuerdo con su edad usted deberia comer X cantidad de vegetales</div></td>\n
</tr>\n
</table>\n
");
if ('$age>=50')
printf("
<table align=center>\n
<tr>\n
<td><div class='body_text_'>$name</div></td>\n
<td><div class='body_text'>de acuerdo con su edad usted deberia comer X cantidad de proteinas</div></td>\n
</tr>\n
</table>\n
");