Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <title>S457948</title>
- <meta name="author" content="Wojciech Walis" />
- <meta name="keywords" content="Zad Dom" />
- </head>
- <body>
- <?php
- if(!isset($_POST['submit']))
- {
- $_SESSION['name'] = $_POST['nazwa'];
- echo $_SESSION['name']
- if(isset($_POST['add']))
- {
- $liczba = $_POST['add_value'];
- $tab = array();
- array_push($tab,$liczba);
- for($x=0;$x<count($tab);$x++)
- {
- $suma=$tab[$x]+$suma;
- }
- $srednia=$suma/count($tab);
- echo "Suma :"; print_r($suma);
- echo '<br>';
- echo "Srednia :"; print_r($srednia);
- $_SESSION['tab']=$tab;
- }else
- {
- echo '<form action="" method="post">';
- echo 'Liczba:<input type="int" name="add_value"><br>';
- echo '<input type="submit" name="add" value="Jeszcze jedna liczba">';
- echo '<input type="submit" name="end" value="zakoncz">';
- echo '</form>';
- }
- }else{
- echo '<form action="" method="post">';
- echo 'Nazwa:<input type="text" name="nazwa"><br>';
- echo '<input type="submit" name="submit" value="Zaakceptuj"><br>';
- echo '</form>';
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement