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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:56:44+00:00 2026-06-01T03:56:44+00:00

I need some advice before I start. My PHP Skills are only 3 months

  • 0

I need some advice before I start. My PHP Skills are only 3 months old so learning as I go.

I need to create an order capture screen that captures the information to a database.

The order form can have up to 150 lines that all need to be captured.

I can create the form easy enough but am wondering what the best way to write this to the database is.

on submitting, I can get the form values using the post method and write them to mysql using:

INSERT INTO example
  (example_id, name, value, other_value)
VALUES
  (100, 'Name 1', 'Value 1', 'Other 1'),
  (101, 'Name 2', 'Value 2', 'Other 2'),
  (102, 'Name 3', 'Value 3', 'Other 3'),
  (103, 'Name 4', 'Value 4', 'Other 4');

Is there a more streamline method of doing this or do I need to repeat the code for 150 lines?

  • 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-01T03:56:45+00:00Added an answer on June 1, 2026 at 3:56 am

    From a usablility standpoint, you may wish to reconsider the design of your form. If the user fills out 149 lines of the order form and accidentally hits the back button, they are going to have a really bad day. Perhaps you should consider capturing a single line at a time, or allowing the user to upload a file (spreadsheet, CSV, etc) containing all of the entries.

    If you cannot change the design of the form, you will need to process the lines in a loop. The loop can look something like this:

    for ( $i = 1; $i <=150; $i++ ) {
        $name = $_POST['name' . $i];
        $value = $_POST['value1' . $i];
        // capture the rest of the field values
        $query = "INSERT INTO (...) VALUES ($name, $value, ...)";
        mysql_query($query);
    }
    

    Alternately, you can append the result of each loop to one big query, and run it after capturing all 150 rows.

    For the sake of brevity, I have left out a few details which you need to add:

    • Escape your inputs to make sure your user doesn’t corrupt your database
    • Consider using PDO or something other than mysql_* to make your database usage easier.
    • Check to ensure that you are not capturing and inserting empty values if a row is left blank.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some advice from experts :) I will develop a website using PHP
I need some advice on a simple bash script. I want to start around
I need some advice. (For those who have already read this before I have
I need some advice. I have to create a subscription notification service for my
Need some high level advice before putting the pieces of an app together.. I'm
I need some advice as to how I easily can separate test runs for
I need some advice on what kind of pattern(s) I should use for pushing/pulling
I need some advice, what is the rule of the thumb when creating Rails
I need some advice on techniques to perform page redirect in asp.net. Which one
Experts - I need some advice in the following scenario. I have a configuration

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.