Jump to content

looping through multipul arrays and inserting into SQL


Bifter

Recommended Posts

Hi,

 

I have a form that once submitted some of its result are stored in arrays, example:

 

(The form has multipul lines with the same input names)

 

<select name="product[]"> once submitted goes into $_GET['product']

 

if I do:

 

// Product ID's

foreach($_GET['product'] as $name => $prodvalue) {

print "$name : $prodvalue<br>";

}

 

the following is returned:

 

0 : 9

 

1 : 10

 

2 : 11

 

3 : 12

 

Aswell as the Product ID's I have 2 other form input structured the same way, so my question is how do I loop through each of the $_GET's ($_GET['product'], $_GET['linequantity'] and $_GET['lineprice']) to add each of them to multipul SQL table rows? Also there will be other records that need to be entered, but, these will be constant, so for instance, if 3 rows are to be added then the other records will be the same for each of the 3 rows.

 

Please help me, I'm goin' nuts!

 

B.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.