# Inserting Array into DataBase FROM A FORM

**URL:** <https://forum.kirupa.com/t/inserting-array-into-database-from-a-form/131568>\
**Category:** Uncategorized\
**Created:** [December 16, 2004, 10:29pm UTC](https://forum.kirupa.com/t/inserting-array-into-database-from-a-form/131568 "2004-12-16T22:29:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GFX\_Wiz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gfx_wiz/32/815_2.png) [@GFX\_Wiz](https://forum.kirupa.com/u/GFX_Wiz)\
**Post date:** [December 16, 2004, 10:29pm UTC](https://forum.kirupa.com/t/inserting-array-into-database-from-a-form/131568/1 "2004-12-16T22:29:32Z")

</div>

Hey Guys!

I always come across geniuses here who have a solution for me…counting on everyone :thumb:

OK…I need to insert data from a form into my database and that data is an array. I googled the living snot out of this and didn’t gat any good, working solutions. So here’s a brief:

[list]  
[_]I know how to set up my form: \<input type=“select” name=“category[]”\>  
[_]I have all my options, and my form action is set to have the data processed by a separate .php page (duh)  
[/list]When I click submit…what do I do with my array to get it into the database? Some additional details:

[list]  
[_]an id is generated and this is for a map table so the table has 2 columns, an id that relates to table1 and my categoryid that is gathered from the form that submitted this informartion as the array  
[/list]So…for each categoryid that is entered into the map table, the generated id from table1 is inserted with it like this:  
[list]  
[_]$table1id | $categoryid (the array from the form)  
[_]$table1id | $categoryid  
[_]$table1id | $categoryid  
[\*]etc.  
[/list]Obviously, the $table1id doesn’t change. Let’s say it’s “12345”. I understand that the data entered will be:

[list]  
[_]12345 (from $generatedID - not an array) | 14 (from $category[0])  
[_]12345 (from $generatedID - not an array) | 07 (from $category[1])  
[_]12345 (from $generatedID - not an array) | 26 (from $category[3])  
[_]etc.  
[/list]But I don’t know what to do with my array on the processing .php page. I only need to know what to do with the array…I know how my generated id is generated and all that…I simply need what I guess would be the $\_POST[$category ARRAY] and the sql query.

I appreciate any help in advance!

peace,  
gfx.wiz =8-)\>
