Created
December 16, 2013 01:35
-
-
Save jshawl/7981130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<form method="post" action="<?php $_SERVER['REQUEST_URI'] ?>" > | |
X= <input type="text" name="x" /> <br /> | |
Y= <input type="text" name="y" /> <br /> | |
Diferença= <select name="expressao"> | |
<option value=">"> > </option> | |
<option value="<"> < </option> | |
<option value="="> = </option> | |
</select> | |
<input type="submit" value="enviar" /> | |
<input type="hidden" name="enviar" value="1" /> | |
</form> | |
<hr /> | |
<?php | |
function tabela () { | |
tabelashow (); | |
} | |
if (!empty($_POST['enviar'])) { | |
$x=$_POST['x']; | |
$y=$_POST['y']; | |
$expressao=$_POST['expressao']; | |
echo "O valor da expressão $x $expressao $y é "; | |
if ($expressao == ">") { | |
if ($x > $y) { | |
echo "Verdadeiro"; | |
tabela (); | |
} | |
else { | |
echo "Falso"; } | |
} | |
elseif ($expressao == "<") { | |
if ($x < $y) { | |
echo "Verdadeiro"; } | |
else { | |
echo "Falso"; } | |
} | |
else { | |
if ($x == $y) { | |
echo "Verdadeiro"; | |
} | |
else { | |
echo "Falso"; } | |
} | |
} | |
?> | |
<hr /> | |
<table border="1"> | |
<?php | |
function tabelashow () { | |
for ($t=1; $t<=3; $t++) { | |
echo "<tr>"; | |
for ($u=1; $u<=3; $u++) { | |
echo("<td>Coluna $u </td>"); | |
} | |
echo "</tr>"; | |
} | |
} | |
?> | |
</table> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment