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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:07:08+00:00 2026-06-05T06:07:08+00:00

I have code in html: <input type=text name=product[0][name] value=name of product 1/> <input type=text

  • 0

I have code in html:

<input type="text" name="product[0][name]" value="name of product 1"/>
<input type="text" name="product[1][name]" value="name of product 2"/>
<input type="text" name="product[2][name]" value="name of product 3"/>
<input type="text" name="product[3][name]" value="name of product 4"/>

I try to send this via $_POST.
When im using

print_r($_POST['product']);

I got list of my products for ex:

Array
(
    [product] => Array
        (
            ['201'] => Array
                (
                    ['name'] => J5313 BEŻOWE
                    ['price'] => 14.99
                    ['quantity'] => 1
                    ['size'] => 36
                    ['product_subtotal'] => 14.99
                )

            ['200'] => Array
                (
                    ['name'] => J5313 SZARE
                    ['price'] => 14.99
                    ['quantity'] => 1
                    ['size'] => 37
                    ['product_subtotal'] => 14.99
                )

        )

)

Everything is ok, but if i want to echo my array variables i have empty vars!
Its my code:

foreach($_POST['product'] as $key => $value){
        echo "product key: $key, product name: ".$value['name']."";
}

What php write in document:

product key: 0, product name:
product key: 1, product name:
product key: 2, product name:
product key: 3, product name:

$key variable is not empty but $value is empty!
I try to change name of $value var but its not solve my problem.
Any one knows what i must to to?

  • 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-05T06:07:11+00:00Added an answer on June 5, 2026 at 6:07 am

    Since it’s unclear, based on your code, why you’re experiencing this problem there are a few debugging steps you could take:

    Show all warnings

    error_reporting(-1);
    ini_set('display_errors', 'On');
    

    Add those two lines to your script and run it; if there are any obvious issues like missing indices it will echo warnings in your page.

    Add more debugging

    Since your loop can find the keys, you should var_dump($value); inside the loop to figure out if perhaps you made a typo (although that would have shown up by showing all warnings.

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

Sidebar

Related Questions

I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have the following code: HTML <div id='foo'> <input type='checkbox' value='english' name='bar[english]' /> <input
I have this simple piece of HTML code: <div> <input type=file name=english-file /> </div>
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
I have a table inside a form that looks as follows: <td><input type=text name=code[0]
so i have this code: <% form_tag(:action => 'find') do%> Product name: <%= text_field(cars_,
I have an input, type text, element which is being validated using MVC3 validation
Hi this is my HTML code:::: <form> <fieldset > <legend><b>TRIP</b></legend> <p> <input type =
In my HTML code, I have a form tag that contains two input boxes,

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.