Skip to content

Instantly share code, notes, and snippets.

@jshawl
Created December 16, 2013 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshawl/7981130 to your computer and use it in GitHub Desktop.
Save jshawl/7981130 to your computer and use it in GitHub Desktop.
<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