PHP   11

PHP form handling

Guest on 15th May 2022 04:19:10 AM

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width, initial-scale=1">
  6.   <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
  7.  
  8.   <title>PHP form handling</title>    
  9. </head>
  10. <body>
  11. <div class="container">
  12.  
  13. <?php
  14.  
  15. // The implicit $_COOKIE global array variable stores cookie names/values
  16. // in an associative array of keys and values.
  17. // To view the cookie data, loop through the array, or
  18. // using var_dump() function
  19.  
  20. if (count($_COOKIE) > 0)
  21. {
  22.    echo '<dl>';
  23.    foreach ($_COOKIE as $key => $value)
  24.    {
  25.       echo "<dt>Key: $key";
  26.       echo "<dd>Value: $value";
  27.    }
  28.    echo '</dl><hr />';
  29.    var_dump($_COOKIE);
  30. }
  31. else
  32.    echo 'Please <a href="cookie-form.html" >Log in</a>';
  33.  
  34. ?>
  35.  
  36. </div>
  37. </body>
  38. </html>

Raw Paste


Login or Register to edit or fork this paste. It's free.