Jump to content

Archived

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

s0niC

Form data to sql problem

Recommended Posts

Hi you experts !

I'm having trouble with the following code :

On a page, a customer can select items wich he wants to buy. He also can fill in the number of items he wants. so it looks like this :

-----------------------------------------------------------------------------------------------
| ITEM 1 | (hidden field with item_id[] as value) | input textbox (name = count[]) |
-----------------------------------------------------------------------------------------------
| ITEM 2 | (hidden field with item_id[] as value) | input textbox (name = count[]) |
-----------------------------------------------------------------------------------------------
| ITEM 3 | (hidden field with item_id[] as value) | input textbox (name = count[]) |
-----------------------------------------------------------------------------------------------


So when the user selects multiple items, i get two arrays when he pushes the send button -->

item_id = array one that contains all the item id's
count = array two that contains all the number of items the customer orders.

But now, i want to insert these numbers in the database. I allready tried with exploding the arrays, but it will not work. The SQL i need to use looks like this :

INSERT count_items INTO TABLE_NAME WHERE itemid = item_id AND client = client_id (also a hidden field but this ones easy)

Ok, for my first message its rather difficult i think, but i really hope someone can help. Other options to do this are always welcome....

Share this post


Link to post
Share on other sites

×

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.