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 8556637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:23:53+00:00 2026-06-11T15:23:53+00:00

I have 2 pages. After the user inserts all their info on page 1,

  • 0

I have 2 pages. After the user inserts all their info on page 1, they go to page 2. All the inputted information gets correctly stored in $_POST so I can access it in the next page. I can also insert into mysql database just fine no problem. The thing I’m trying to do is to ONLY execute the insert into the database code IF they click the submit button on the second page. I tried doing this:

Page2.php

<script>
$(document).ready(function(e) {
    $("#PaySubmit").click(function() {
        $.ajax({
            url: 'Insert.php'
        });
    });
});
</script>
<input type="submit" name="PaySubmit" id="PaySubmit" value="Continue"/>

Insert.php

try {
    $link = new PDO('mysql:host=****;dbname=****;charset=UTF-8','****','****');
    $first = $_POST["fname"];
    $last = $_POST["lname"];

    $stmt = $link -> prepare("INSERT INTO Conference (`First Name`, `Last Name`) VALUES (:first, :last)");
        $stmt->bindParam(':first', $first);
        $stmt->bindParam(':last', $last);
    $stmt->execute();

} catch(PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}

The problem is, when you click submit on the 2nd page $_POST gets replaced with data from the second page, so I no longer have access to the 1st page’s data. Any ideas on how to go about this?

  • 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-06-11T15:23:54+00:00Added an answer on June 11, 2026 at 3:23 pm

    Store all the values from the first post in the current SESSION.

    You can then access them with the $_SESSION global.

    Have a look at the serialize function, it might be able to help you a lot. Or json_encode. They are very useful for storing arrays in one variable and retrieving it later.

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

Sidebar

Related Questions

I have a page where a user submits an order, and after they submit
I have pay now form on my page and after user finishes his payment
I have a page where I need to capture input from a user after
I have two pages, on the first page after an event happens I change
I have a custom background image on one of my Wordpress login pages. After
Hi I have a web page that opens up from another page after the
I have page named page--news.tpl.php, which i created for my news page. But after
hi i need to have a graph in my html page after searching for
I have a situation where the forms on my page disappear after a single
I have a page index.php that uses a modal to upload files. After those

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.