Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7175413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:17:19+00:00 2026-05-28T16:17:19+00:00

I need to develop a form that spans multiple pages, but requires just one

  • 0

I need to develop a form that spans multiple pages, but requires just one PHP script. On the first page, visitors are presented with a series of checkboxes. Depending on their choice(s), additional pages must be displayed in a specific order and then to a closing page. Each page contains a hidden input identifying what page number it is. What I have so far is this:

if(!isset($currentPage)) {
  echo $firstPage;
}
else {
  echo nextPage($currentPage);
}

function nextPage($lastPage) {
  switch($lastPage) {
    case '0':
      if(isset($opt1)) {
        return $page1;
      }
      else if(isset($opt2)) {
        return $page2;
      }
    case '2':
      if(isset($opt3)) {
        return $page3;
      }
    case '3':
    case '1':
      return $page4;
  }
}

The above code properly identifies whether to display page1, page2 or page3 after the starting page, but after that, no matter what other choices may have been selected, it always directs the visitor to the closing page (page4). What am I missing? Or have I gone about this all wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:17:21+00:00Added an answer on May 28, 2026 at 4:17 pm

    I would suggest storing answers in a session variable until the user finishes the survery.

    So put

    session_start();
    

    on top of the script before outputing any text

    and then whenever a user submits a form, goes to next page do this:

    $_SESSION['answers'] = array_merge($_POST, $_SESSION['answers']);
    

    This would store answers to one array, which you can then use when user finishes the survey.

    *hint: since it’s using array merge make sure the radio buttons on different pages have different names. Like: question_1, question_2..*

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to develop a simple form (intended only for printing) to be filled
I need to develop a process that will detect if the users computer has
trying to develop web form using jquery. all i need is to have several
I am looking for a form class that: Is standalone/doesnt need a framework to
I have to develop a semi-transparent form in WPF, but controls should not be
I need to develop a front end to a MSSQL database just to modify
I need to develop an ActiveX control that can read CD's and USB drives.
I'm developing a .NET WINDOWS FORM Application , I need to develop a search
I need to develop a custom trackback/pingback module for a page where trackbacks/pingbacks are
Every time I develop a new form that includes a textarea I have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.