Jump to content

Dealing with post data arrays


rsagona1

Recommended Posts

Hello, the best way to describe this is with a picture.

 

 

todob.jpg

 

As you can see, I already know how to loop through the Product[] array and check if it is checked, and if so, insert it into the mySQL database.

 

But how can I tie the quantity to each checkbox?

 

The quantity would be a textbox. I could name each textbox the product ID (like 1,2,3..etc). But I don't see how that would help.

 

Can anyone please help me?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/150776-dealing-with-post-data-arrays/
Share on other sites

Actually, I think I may have solved it.

 

Since the textbox name would be unique (the product number) I could do this:

 

	while (list ($key,$val) = @each ($products))
{
	 //$val would be product code, like Month_Fee
                 //therefore quantity could be:txtboxQuantity{$val}
                 $quantity = $_POST['txtboxQuantity$val];

   

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.