Advertisement
min_m3

PHP sessions

Jun 16th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. // i have tried a few options - url parameter /?client_feddback=1
  2.  
  3. //option 1
  4.  
  5. <?php
  6. session_start();
  7.  
  8. $_SESSION["client_feedback"] = $_GET['client_feedback'];
  9.  
  10. if( isset( $_SESSION["client_feedback"] ) != "" ) {
  11.     ?> <style type="text/css">#form__feedback {display:block!important}</style> <?php
  12. } else {
  13.     ?> <style type="text/css">#form__feedback {display:none!important}</style> <?php
  14. }
  15. ?>
  16.  
  17. //option 2
  18.  
  19. <?php
  20. session_start();
  21.  
  22. if (isset($_GET["client_feedback"]) && $_GET["client_feedback"] !== "") {
  23. $_SESSION["client_feedback"] = $_GET['client_feedback'];
  24. }
  25.  
  26. if (isset($_SESSION["client_feedback"]) {
  27.     ?> <style type="text/css">#form__feedback {display:block!important}</style> <?php
  28. } else {
  29.     ?> <style type="text/css">#form__feedback {display:none!important}</style> <?php
  30. }  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement