 <p>Store the questions and a counter to store which question has been asked in <code>$_SESSION['questions']</code>. Use the counter (also stored in the <code>$_SESSION</code>) to figure out what the next question is and increment it after each submit.</p> <p>To do this check after <code>session_start();</code> if <code>$_SESSION['questions']</code> is set. If not get your questions and store them into <code>$_SESSION['questions]</code> and set the counter to 0.</p> <p>Instead of the <code>foreach()</code> you access your questions by <code>$_SESSION['questions'][$_SESSION['counter']]</code> but do not forget to increase the counter each time.</p> <hr> <p>Sample code:</p> <p>The part to set set / get the questions and increase the counter: <pre><code>session_start(); if(!isset($_SESSION['questions'])) { $query = "SELECT * FROM question_table"; $statement = $db-&gt;prepare($query); $statement-&gt;execute(); $question = $statement-&gt;fetchall(); $statement-&gt;closeCursor(); $_SESSION['questions'] = $question; $_SESSION['counter'] = 0; } if (isset($_POST["submit"])){ // DO YOUR STUFF $_SESSION['counter']++; } ?&gt; </code></pre> <p>The part the output the question:</p> <pre><code>&lt;?php $question = $_SESSION['questions'][$_SESSION['counter']]; if(empty($question)) { // FINISHED ALL QUESTIONS } else { ?&gt; &lt;form action="QuestionAndOption.php" method="POST"&gt; Question &lt;?php echo $_SESSION['counter'] . ": " . $question["Question"]; ?&gt;&lt;br&gt; A: &lt;input type="radio" name="option" value="OptionA"&gt; &lt;?php echo $question["OptionA"]; ?&gt;&lt;br&gt; B: &lt;input type="radio" name="option" value="OptionB"&gt; &lt;?php echo $question["OptionB"]; ?&gt;&lt;br&gt; C: &lt;input type="radio" name="option" value="OptionC"&gt; &lt;?php echo $question["OptionC"]; ?&gt;&lt;br&gt; D: &lt;input type="radio" name="option" value="OptionD"&gt; &lt;?php echo $question["OptionD"]; ?&gt;&lt;br&gt; &lt;button name="submit" type="submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; &lt;?php } // if close ?&gt; </code></pre>