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

  • Home
  • SEARCH
  • 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 6362265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:53:11+00:00 2026-05-24T23:53:11+00:00

I am trying to create a multi steps form where user will fill the

  • 0

I am trying to create a multi steps form where user will fill the form on page1.php and by submitting can go to page2.php to the next ‘form’. What would be the easiest way?

Here is my code:

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
?>

<form id="pdf" method="post">
New project name:<input type="text" name="pr_name" placeholder="new project name..."><br/>
New project end date:<input id="datepicker" type="text" name="pr_end" placeholder="yyyy-mm-dd..."><br/>

<textarea class="ckeditor" name="pagecontent"  id="pagecontent"></textarea>

<?php    
if ($_POST["pr_name"]!="")
{

  // data collection
  $prname = $_POST["pr_name"];
  $prend = $_POST["pr_end"];
  $prmenu = "pdf";
  $prcontent = $_POST["pagecontent"];

  //SQL INSERT with error checking for test 
  $stmt = $pdo->prepare("INSERT INTO projects (prname, enddate, sel, content) VALUES(?,?,?,?)");

  if (!$stmt) echo "\nPDO::errorInfo():\n";

  $stmt->execute(array($prname,$prend, $prmenu, $prcontent));
 }
// somehow I need to check this
if (data inserted ok) {
  header("Location: pr-pdf2.php");
 }
}

$sbmt_caption = "continue ->";
?>

<input id="submitButton" name="submit_name" type="submit" value="<?php echo $sbmt_caption?>"/>
</form>

I have changed following Marc advise, but I don’t know how to check if the SQL INSERT was OK.
Could give someone give me some hint on this?

thanks in advance

Andras

the solution as I could not answer to my question (timed out:):

Here is my final code, can be a little bit simple but it works and there are possibilities to check and upgrade later. Thanks to everyone especially Marc.

<form id="pdf" method="post" action="pr-pdf1.php">
New project name:<input type="text" name="pr_name" placeholder="new project name..."><br/>
Email subject:<input type="text" name="pr_subject" placeholder="must be filled..."><br/>
New project end date:<input id="datepicker" type="text" name="pr_end" placeholder="yyyy-mm-dd..."><br/>

<textarea class="ckeditor" name="pagecontent"  id="pagecontent"></textarea>

<?php
include_once "ckeditor/ckeditor.php";
$CKEditor = new CKEditor();
$CKEditor->basePath = 'ckeditor/';
// Set global configuration (will be used by all instances of CKEditor).
$CKEditor->config['width'] = 600;   
// Change default textarea attributes
$CKEditor->textareaAttributes = array(“cols” => 80, “rows” => 10);
$CKEditor->replace("pagecontent");


if ($_SERVER['REQUEST_METHOD'] == 'POST')
 {
  // data collection
  $prname = $_POST["pr_name"];
  $prsubject = $_POST["pr_subject"];
  $prend = $_POST["pr_end"];
  $prmenu = "pdf";
  $prcontent = $_POST["pagecontent"];

  //SQL INSERT with error checking for test 
  $stmt = $pdo->prepare("INSERT INTO projects (prname, subject, enddate, sel, content) VALUES(?,?,?,?,?)");
  // error checking
  if (!$stmt) echo "\nPDO::errorInfo():\n";
  // SQL command check...
  if ($stmt->execute(array($prname, $prsubject, $prend, $prmenu, $prcontent))){
   header("Location: pr-pdf2.php");
     }
      else{
       echo"Try again because of the SQL INSERT failing...";
      };
   }

$sbmt_caption = "continue ->";
?>

<input id="submitButton" name="submit_name" type="submit" value="<?php echo $sbmt_caption?>"/>
</form>
  • 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-24T23:53:12+00:00Added an answer on May 24, 2026 at 11:53 pm

    A basic structure like this will do it:

    form1.php:

    <?php
    
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
       ... process form data here ...
       if (form data ok) {
           ... insert into database ...
       }
       if (data inserted ok) {
          header("Location: form2.php");
       }
    }
    ?>
    
    ... display page #1 form here ...
    

    And then the same basic structure for each subsequent page. Always submit the form back to the page it came from, and redirect to the next page if everything’s ok.

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

Sidebar

Related Questions

I'm trying to create a multi-level ajax form on my rails app that can
I am trying to create a multi step form using model classes: my view:
I am trying to create a Multi-Language WPF program that will load it's languages
In a multi form .NetCF 3.5 application I'm trying create the forms in the
I am trying to create a multi threaded PHP application right now. I have
I am currently trying to create a multi-page form that uses both jQuery and
I'm going to create a multi user app, so, I will have a admin
I am trying to comprehend how I can create multi-dimensional NSMutable arrays in general.
I am trying to create a multi dimensional array using this syntax: $x[1] =
I am trying to create a multi project template. I wish the sub projects

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.