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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:25:09+00:00 2026-05-13T05:25:09+00:00

I have a database that has two tables, one of which contains a foreign

  • 0

I have a database that has two tables, one of which contains a foreign key back to the first. Similar to this:

Table1
    id
    description
    some
    other
    information

Table2
    table1ID
    Some
    other
    information

For each table1 there can be any number of entries in table2. I need to create a form that allows users to insert new items into tables 1 and 2. I’ve run into this issue in a number of projects. In one, it’s saving role playing game stats. Table1 is the vehicles table and Table2 holds information on each of the vehicle’s weapons.

I can think of two ways to handle this. One is to show all the information in one form, and use Javascript to allow users to add new sub-forms for each weapon as they need them. Then process it all at once. However, this is a little ugly and, obviously, relies on javascript. So it’s not friendly to those who have javascript turned off.

The other way I can think of, would be to have multiple pages. The first page would allow the user to enter general data, then they could hit next to enter weapon data. Each time they hit next, they could enter a new weapon. Finally the fully entered vehicle would be displayed to them and they would be able to go back and edit each part of it as they so choose and, when they were ready, submit it.

On the one hand, this way requires a lot more processing than the first. It is much more involved. It would require that each step of the vehicle’s creation be added to the database for temporary storage while the user worked on it. It would have to be marked as incomplete. I would have to create some sort of cron job to clean out all the incomplete vehicles.

On the other hand it uses no javascript.

Are there other ways of handling situations like this? If not, which of these two methods is considered the better practice? Is there a way to hang on to the data between form pages in the second method with out temporarily adding it to the db?

The tools I have available to me are a MySQL database, PHP, javascript, html/css (obviously), and a linux operating system.

  • 1 1 Answer
  • 1 View
  • 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-13T05:25:09+00:00Added an answer on May 13, 2026 at 5:25 am

    What I would do is use javascript. From my point of view, not many people nowadays have javascript turned off.

    But, if you choose not to use javascript, there is another way to avoid the extra overhead.

    You could try to store the second table resultset in a session or cookie.

    Let’s face the facts, HTTP doesn’t have great data persistence capabilities.

    Good luck!

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

Sidebar

Related Questions

I have two database tables: 'MyTable' which has a standard auto-incrementing primary key integer
I have a database structure that has a Person table which contains fields such
I have two tables in my database which have a one-to-one relationship. I want
So I have this application in ASP MVC 3. My database has two tables:
I have a database structure that has two one-to-many relationships. I have a website,
I have a database with two tables. One of the tables contains users, the
My database has two tables, one contains a list of users, the other a
I have a Play Framework (1.2.4) project with PlayMorphia that has two different database
I have a database that has four columns like this level_1, level_2, level_3, level_4
I have a database that has node & nodetype tables. Nodes table NodeID ParentNodeID

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.