Jump to content

Form data to sql problem


s0niC

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....
Link to comment
https://forums.phpfreaks.com/topic/9983-form-data-to-sql-problem/
Share on other sites

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.