Skip to content

Instantly share code, notes, and snippets.

@matchs
Created October 12, 2014 03:28
Show Gist options
  • Save matchs/7599316a7f4f837659bc to your computer and use it in GitHub Desktop.
Save matchs/7599316a7f4f837659bc to your computer and use it in GitHub Desktop.
operacoes.tpl
@file_path operacoes
@file_ext php
@file_name Operadores
@file_langs php
<?php
@features F002.001
echo "<html><head><title>Operador: Soma</title></head>";
@features F002.002
echo "<html><head><title>Operador: Subtração</title></head>";
echo '<form method="post" action="operacoes.php">';
echo '<label for="a">Valor A:</label><input type="text" maxlength="5" name="a" /><br/>';
@features F002.001
echo '+<br/>';
@features F002.002
echo '-<br/>';
echo '<label for="b">Valor B:</label><input type="text" maxlength="5" name="b" /><br/>';
@features F002.001
echo '<input type="submit" value="Somar!" />';
@features F002.002
echo '<input type="submit" value="Subtrair!" />';
echo '</form>';
@features F002.003
if(isset($_POST['a'])){
$a = $_POST['a'];
$b = $_POST['b'];
@features F002.001
echo '<h3>'.$a.' + '.$b.' = '.($a+$b);
@features F002.002
echo '<h3>'.$a.' - '.$b.' = '.($a-$b);
}
echo "</body></html>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment