<input type="radio" name="firstPage[11]" value="3"/>3 <input type="radio" name="firstPage[11]" value="4"/>4 </div> <div class="button"> <input type="submit" name="firstPageSubmit" value="Go to Page 1 of 3" /> </div> </form> <?php } elseif (!empty($_POST["firstPageSubmit"]) && empty($_POST["secondPageSubmit"])) { if (!empty($_POST["firstPage"])) { //echo '</br>saving first page</br>'; $firstPage = $_POST['firstPage']; $lastId = $vote->saveFirstPage($firstPage); //echo 'lastId sss'.$lastId; } ?> <form name="secondPage" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> " method="post"> <input hidden name="startSubmit" value="true"> <input hidden name="firstPageSubmit" value="true"> <input hidden name="lastId" value="<?php echo $lastId; ?> ">