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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:48:33+00:00 2026-06-15T23:48:33+00:00

I have a form where I am editing my orders.On my edit order page,

  • 0

I have a form where I am editing my orders.On my edit order page, I am breaking down my orders.For example, Order details (Customer name,address etc) and then order items like this:

Order Details:

     <form name="edit_order" id="edit_order" method="post">
      <? 
     if ($order_details) {
                //    print_array($order_details);
                    foreach ($order_details as $key => $link) {
                    ?>
                    <div width="200">
                        <div><b>Product: </b> <br><?=$link->product_name?> - <?=$link->product_id?></div>  
                        <div><strong>Cost:</strong><br>&pound;<?=$link->unit_cost?></div>
                        <div><strong>Pack Qty:</strong><br><input name="quantity" id="quantity" value="<?=$link->quantity?>" style="width:50px;"   /> </div> 
                        <div><strong>Pack Cost:</strong> <br><input name="pack_cost" id="pack_cost" value="<?=$link->pack_cost?>" style="width:50px;" />   </div>
                           <div><strong>Pallet Qty:</strong><br><input name="pallet_quantity" id="pallet_quantity" value="<?=$link->pallet_quantity?>" style="width:50px;" />  </div>
                           <div><strong>Pallet Cost:</strong><br><input name="pallet_quantity" id="pallet_quantity" value="<?=$link->pallet_unit?>" style="width:50px;" />  </div>

                    </div>
                    <?
                    }
                }
           ?>

MY Question is :

How can I retrieve these values for multiple fields(input boxes) on next page?

For example,if I edit “pallet_quantity” and “pack_cost” of 10 products on edit order page then how can i retrieve them on next page using the loop to save them in the database?.

When I try to display values on web page like this : print($_POST['pack_cost']) ,it gives me single value.How can I loop through the POST array to display and save my edited values into the database?.
Help me plz.

  • 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-15T23:48:34+00:00Added an answer on June 15, 2026 at 11:48 pm

    You can make array for input values. Look the below code …

    <input name="pack_cost[]" id="pack_cost1" value="<?=$link->pack_cost?>" style="width:50px;" />
    <input name="pack_cost[]" id="pack_cost2" value="<?=$link->pack_cost?>" style="width:50px;" />
    <input name="pack_cost[]" id="pack_cost3" value="<?=$link->pack_cost?>" style="width:50px;" />
    

    just remember that the id of these input boxes should be different.

    So, when you make echo $_POST[‘pack_cost’] on next page, you will get an array named pack_cost containing key and value.

    EDITED

    WHOLE CODE :-

    <form name="edit_order" id="edit_order" method="post">
    <? 
    if ($order_details) {
         //    print_array($order_details);
         foreach ($order_details as $key => $link) {
    ?>
        <div width="200">
            <div><b>Product: </b> <br><?=$link->product_name?> - <?=$link->product_id?></div>  
            <div><strong>Cost:</strong><br>&pound;<?=$link->unit_cost?></div>
            <div><strong>Pack Qty:</strong><br><input name="quantity[]" id="quantity<?php echo $key; ?>" value="<?=$link->quantity?>" style="width:50px;"   /> </div> 
            <div><strong>Pack Cost:</strong> <br><input name="pack_cost[]" id="pack_cost<?php echo $key; ?>" value="<?=$link->pack_cost?>" style="width:50px;" />   </div>
            <div><strong>Pallet Qty:</strong><br><input name="pallet_quantity[]" id="pallet_quantity<?php echo $key; ?>" value="<?=$link->pallet_quantity?>" style="width:50px;" />  </div>
            <div><strong>Pallet Cost:</strong><br><input name="pallet_quantity[]" id="pallet_quantity<?php echo $key; ?>" value="<?=$link->pallet_unit?>" style="width:50px;" />  </div>
        </div>
     <?
        }
     }
     ?>
    </form>
    

    This is what, which will outputs your need.

    Below is the code for fetching your return values

    if($_POST)
    {
        $field_array = array();
        for( $i=0 ; $i < count($_POST['pack_cost']) ; $i++ )
        {
            $field_array[$i]['quantity']        = $_POST['quantity'][$i];
            $field_array[$i]['pack_cost']       = $_POST['pack_cost'][$i];
            $field_array[$i]['pallet_quantity'] = $_POST['pallet_quantity'][$i];
            $field_array[$i]['pallet_cost']     = $_POST['pallet_cost'][$i];
    
            // if you require then the query for your database
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page on my site with a form for editing event information
I have a form for editing a ticket that requires a Reason for Edit.
I have a form for editing notifications that looks like: <form action='edit.php' method =
I have a form for creating/editing an event. There is a Client drop down
I have a form that handles editing of a domain model (A). This domain
I have a longish form that scrolls vertically and also allows editing records. When
I have created a form that is used for both adding and editing a
I have form in my page, I am using ajax.beginform(). Inside this form I
Let's say I have a form for adding/editing products (with field 'user' being a
I have a jqGrid that has add/edit dialogs with a form that's longer than

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.