Advertisement
Guest User

Untitled

a guest
May 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <?php
  2.  
  3. session_set_cookie_params(86400, '/', '...');
  4. session_name('...');
  5. session_start();
  6.  
  7. //It's about this session variable
  8. //before having redirecting to this page, the Session variable had been set to -1
  9. $_SESSION["questionAmount"]++;
  10.  
  11.  
  12. if ($_SESSION["questionAmount"] == 3) {
  13. header('Location: /thankyou.php');
  14. }
  15.  
  16. //connecting to database
  17.  
  18. $sql = "SELECT * FROM `questions` WHERE `id` = '".$_SESSION["questionAmount"]."';";
  19.  
  20. //executing $sql
  21.  
  22. //work something WITHOUT using or changing the session var
  23.  
  24. <form method="post" action="#" name="Formular" id="form_source">
  25. <fieldset>
  26. <div id="question_wrapper">
  27. <p id="question_question" style="display: none;"><?php echo $question; ?></p>
  28. </div>
  29. <p id="place"></p>
  30. <div id="submit1_div" style="padding: 5px;">
  31. <button id="submit1" name="answer" value="answer1" style="display: none;"><?php echo $answer1; ?></button>
  32. </div>
  33. <div id="submit2_div" style="padding: 5px;">
  34. <button id="submit2" name="answer" value="answer2" style="display: none;"><?php echo $answer2; ?></button>
  35. </div>
  36. <div id="submit3_div" style="padding: 5px;">
  37. <button id="submit3" name="answer" value="answer3" style="display: none;"><?php echo $answer3; ?></button>
  38. </div>
  39. <div id="submit4_div" style="padding: 5px;">
  40. <button id="submit4" name="answer" value="answer4" style="display: none;"><?php echo $answer4; ?></button>
  41. </div>
  42. </fieldset>
  43. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement