Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if (!isset($_SESSION['errors'])) {
  5.     $_SESSION['errors'] = array();
  6. }
  7.  
  8. if (isset($_REQUEST['action'])) {
  9.     $_SESSION['errors'][] = 'Ошибка!!';
  10.     header('Location: ?');
  11.     exit();
  12. }
  13.  
  14. ?>
  15. <!DOCTYPE html>
  16. <html>
  17.     <head>
  18.         <meta charset="UTF-8">
  19.         <title></title>
  20.     </head>
  21.     <body>
  22.         <form action="?action=test" method="POST">
  23.             <input type="text" value="12"/><input type="submit" value="hello"/>
  24.         </form>
  25.         <?php
  26.         echo('<p>+'.count($_SESSION['errors']));
  27.         if (count($_SESSION['errors']) != 0) {
  28.             echo('<p>-'.count($_SESSION['errors']));
  29.             $_SESSION['errors'] = array();
  30.         }
  31.         ?>
  32.     </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement