Tengo el sigiente problema. He realizado el siguiente condicional if/elseif/elfe:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
</head>
<body bgcolor="chartreuse">
<font face="arial" size="+1">
<?php
extract ( $_REQUEST ) ; //Se obtiene de la informacion de entrada
if ( ! isset ( $submit_fare ) | | $age == " " ) {
print "Debes de introducir tu edad!<br />";
exit ;
}
?>
<table border="1" cellpadding="10">
<tr bgcolor="azure">
<?php
if ( $age > 0 && $age < 13 ) {
$price = 5.00;
print "<td><b>You pay \$$price, the child's fare!</td>";
}
elseif ( $age >= 13 && $age < 55 ) {
$price = 8.25;
print "<td><b>You pay \$$price, regular adult fare!</td>";
}
elseif ( $age >= 55 && $age <= 120 ) {
$price = 10.00;
print "<td><b>You pay \$$price, the senior fare!</td>";
}
else {
print "<td><b>You are not a human!</td>";
}
?>
</body>
</html>