Jump to content


Photo

Form data to sql problem


  • Please log in to reply
No replies to this topic

#1 s0niC

s0niC
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 May 2006 - 06:19 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users