Forum Moderators: coopster

Message Too Old, No Replies

array within an array

not sure where to start

         

neonpie

11:45 am on Feb 23, 2006 (gmt 0)

10+ Year Member



hi guys,

i have no experience with arrays what-so-ever, but i think this is what i might need, but i dont know where to start.

i have a form that needs to input tax into a mysql db.
the form has company 1 to 5 and 3years ago, 2years ago, 1years ago, this year, next year.

so is it possible to just have one field for tax which will hold upto the five companies and the 5 values of tax.

this form is obviously alot bigger than just one entry of tax, so i have to create 45 fields per company(9 types of entires x 5 years x 5 companies) so i dont want to end up with 225 fields in the db just for this tax part - not inc the rest of the form.

any help would be great - remember i have never touch arrarys so any code snippets please explain.

thanks in advance

coopster

5:09 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, neonpie.

Sounds like more of a database design issue here as opposed to how to setup a multi-dimensional array. Have you considered that instead? If you want to know how to setup arrays in an HTML form for use with PHP, this FAQ on PHP and HTML [php.net] will be enlightening.

phparion

6:45 pm on Feb 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



well, i have a different view.

your question is about to reduce the number of fields in your table for holding tax info in database. so I dont think so it has to do with Arrays at all. you need to ask this question in MySQL forum for fruitful reponse.

neonpie

9:48 am on Feb 24, 2006 (gmt 0)

10+ Year Member



ok thanks guys for your help - i just thought it could be done in php before it was inserted into the db - as mentioned i didnt know anything about arrays (althought i get the principle of it) and wasnt sure where to start

thanks for your responses

coopster

4:38 pm on Feb 24, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can indeed create the arrays automagically in PHP when your form is setup as such, don't get it wrong here. I was merely asking exactly what you are trying to accomplish and how you intend to store the data. Perhaps some more detail and we can help ...

neonpie

9:26 pm on Feb 25, 2006 (gmt 0)

10+ Year Member



thanks coopster
i have posted my latest message here
[webmasterworld.com...]
that explains the form little more