Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function start_page($title)
- {
- echo ' <!DOCTYPE html>
- <html lang="fr">
- <head><title>' . PHP_EOL . $title . '</title></head>
- <body>' . PHP_EOL
- ;
- };
- function end_page()
- {
- echo '</body>
- </html>' . PHP_EOL
- ;
- };
- start_page('Premier pas en PHP');
- $op1 = $_POST['op1'];
- $op2 = $_POST['op2'];
- $op = $_POST['action'];
- if('*' == $op){
- echo $op1 * $op2;
- }
- elseif('+' == $op){
- echo $op1 + $op2;
- }
- elseif('-' == $op){
- echo $op1 - $op2;
- }
- else{
- echo '<br/><strong>opérateur ' . $op . ' non géré </strong>';
- }
- end_page();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement