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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:22:34+00:00 2026-06-11T01:22:34+00:00

i am trying to setup a product page, with multiple products etc… It is

  • 0

i am trying to setup a product page, with multiple products etc… It is done through a while loop getting the data from a mysql database, the products display fine, but the problem i am having is that i want to be able to process each product individually, In other words, i don’t know what products may be appearing on the page, so when i try to process them through php, it needs to be flexible. Its a bit hard to explain but here is my current code, hopefully you will see what i mean.

Here is my html for one individual product, all the products get ouputed like the code below

 <form id="<?php print "$material_id";?>" class="form">    
      <div class="supp_bro_mat_wrap">    
            <input type="hidden" name="supp_bro_mat_id" value="<?php print "$material_id";?>" />        
            <input name="supp_bro_qty_input" class="supp_bro_qty_input" type="text" />              
      </div><!---end supp_bro_input_wrap--->
            <input name="supp_bro_add_to_cart" type="submit" class="supp_bro_add_to_cart" id="<?php print "$material_id";?>" />          
 </form>

And here is the php code, simple i know, but i just want to be able to get the values at this stage,

 if (isset($_POST['supp_bro_add_to_cart'])) {


    $mat_id = $_POST['supp_bro_mat_id'];
    $mat_qty = $_POST['supp_bro_qty_input'];

    var_dump($mat_id);
    var_dump($mat_qty);
}

And when i try to enter a quantity for the first product i get the right var_dumps appear, but when i try it on all the products below it i get

supplies_browse.php?supp_bro_mat_id=5&supp_bro_qty_input=8768&supp_bro_add_to_cart=Submit

appear in my browser header instead of

supplies_browse.php?sid=masonary

Like it should be and no var_dumps. Hopefully you will get what i mean, let me know if you need anything else.

Thanks

  • 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-11T01:22:35+00:00Added an answer on June 11, 2026 at 1:22 am

    It not easy to tell from what you’ve posted, but it looks like you have an additional <form> tag in your HTML that precedes the products list. This additional <form> tag has method="POST" on it.

    Because of this, on your products list, the <form> tag of the first product is being ignored (form elements are not allowed to be nested) so submitting the first product performs a POST submit, so the data gets transferred in the HTTP body, the URL has the value that you want, and your $_POST variables get populated correctly.

    The </form> tag at the end of the first product then closes the additional <form>, and the second product and subsequent products are created in their own forms. The <form> tags for these have no method attribute specified, so the default method is used which is GET. This sends the information on the URL, which will not populate the $_POST variables.

    The solution is to remove the additional <form> tag from the start of your page, and move the method="POST" attribute (and probably any other attributes on that tag) to each of the <form> tags for the products.

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

Sidebar

Related Questions

Im trying to setup my asp.net mvc page like the following image: The header
Current Setup Each product on the store has multiple images. When the visitor visits
Basically, Im trying to setup a page so that when a link is clicked
I'm trying to setup a search page which performs two separate kinds of search
I'm using the Secure FTP product from EnterpriseDT . The setup below worked for
I am trying to setup a view shopping cart/basket page within a site in
I am trying to evaluate whether we should migrate from developing our product in
Trying to setup a personal image upload/downloader webpage. I've viewed the msdn article on
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
Trying to setup some validation on the add to cart button for the dropdown

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.