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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:46:10+00:00 2026-06-11T16:46:10+00:00

I have a multi-part form where pressing either Back or Next will cause that

  • 0

I have a multi-part form where pressing either “Back” or “Next” will cause that part to be submitted and stored into the database (MySQL); only difference is if it goes to the next or previous form.

Take note that the subsequent parts (second part onwards) are child tables of the table of the first part. They have ‘ePARno’ as a foreign key.

The first part executes this snippet:

if( isset( $_SESSION[ 'eparno' ] ) ) { //if it's an edit, replace
        $eparno = $_SESSION[ 'eparno' ];
        $insert_query_0 = mysql_query ("
            REPLACE INTO form 
                (ePARno, caseno, accomplishedby)
                VALUES 
                ('$eparno', '$caseno', '$accomplishedby')
        ");
}
else { //otherwise, it's a fresh insert
    $insert_query_0 = mysql_query ("
        INSERT INTO form 
            (caseno, accomplishedby)
            VALUES 
        ('$caseno', '$accomplishedby')
    ");
     $eparno = mysql_insert_id();
}

My problem arises when I go press back on the second form, bringing me to the first form, and return to it by hitting next. What happens when I do that is the inserted row of the second form gets inserted (by virtue of pressing Back) but it disappears from the table when I press Next from the first form. (I view the database through phpmyadmin simultaneous with the pressing of back and next, step-by-step)

I suspect that this has something to do with the first form replacing the parent row. If it executes the REPLACE, I suspect that the child row(s) which is/are already there, such as that of the second form, get deleted.

I must also say that if I don’t go back, things go on smoothly. No rows disappearing.

Does my suspicion have any merit? If so, how do I remedy this? If not, what could be the problem?

  • 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-11T16:46:12+00:00Added an answer on June 11, 2026 at 4:46 pm

    REPLACE does a DELETE and INSERT. I would guess that the DELETE is cascading to the child tables.

    Try INSERT...ON DUPLICATE KEY instead.

    Is ‘caseno’ your primary key? If so, maybe it’s this:

    INSERT into form (caseno, accomplishedby) values (?,?)
    ON DUPLICATE KEY UPDATE eparno = values(eparno), accomplishedby = values(accomplishedby)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that uses a multi-part form and HTML5 file object to
So I have a multi-part form that is supposed to auto fill another input.
I am getting a strange behavior for multi-part form. I have a simple HTML
We have multi-part install that needs a reboot to continue. We added a RunOnce
I have an object that has a multi-part key and I am struggling to
This is probably a multi-part question. Background: we have a native (c++) library that
I'm creating a multi-part form in the style that Ryan Bates describes here: http://railscasts.com/episodes/217-multistep-forms
I have the code below to advance through a multi-part form for signup. Need
I have a multi page form that I am trying to implement on my
I have a form for that a user fills out and submits. Once submitted

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.