title: PHP: How to pass variable from one page to another without a form or button, and without using session variable?
body: <p>This is a follow-up question to this one: <a href="https://stackoverflow.com/questions/25072599/how-to-access-a-variable-from-one-php-page-to-another-without-a-form-link-or/25072958#25072958">How to access a variable from one PHP page to another, without a form, link, or button?</a></p>
  
  <p><strong>SCENERIO:-</strong></p>
  
  <p>As mentioned in the first question, there is a <code>form</code> defined in a file named <code>question_edit_form.php</code>. The <code>action</code> of this form is set to a file named <code>question.php</code>. <em>So all the data in the form is obviously passed to question.php.</em> </p>
  
  <p><strong><em>But I added a <code>select</code> element in the form and I want this element's data to be passed to another file named <code>renderer.php</code>.</em></strong> This file is responsible for displaying the question to the student in a quiz so that they can write its answer.</p>
  
  <p><strong>FIRST PROPOSED SOLUTION- SESSION VARIABLE:-</strong></p>
  
  <p>So the first solution was to use a session variable. It worked in one scenerio, but failed in the other, 'practical' one.</p>
  
  <p>The thing is the <code>question_edit_form</code> is used by a teacher to edit a question- that is one session. A student answers that question in another session. <strong><em>So obviously that session variable is not available to renderer.php when it displays the question to the user</em></strong> (because it is another session).</p>
  
  <p><strong>SECOND PROPOSED SOLUTION - COOKIES:-</strong></p>
  
  <p>The other solution is using cookies. But <a href="http://www.w3schools.com/php/php_cookies.asp" rel="nofollow noreferrer">reading up on cookies here tells me</a> that </p>
  
  <blockquote>
    <p>A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. </p>
  </blockquote>
  
  <p>So the server will put the variable on the user's computer. But the student will attempt many questions in the same session and the variable's value will be different for each question. </p>
  
  <p><strong>QUESTION:-</strong></p>
  
  <p><strong>So can <code>cookies</code> be used in this scenerio? or is there another solution to pass the variable to the file <code>renderer.php?</code></strong></p>