6
« on: May 28, 2004, 12:03:16 AM »
Well a quick question here. Basically I am trying to learn the concept of arrays, and this is what I am trying to do.
On the form page we have all our variables and are ready to be filled out. $_POST is the array created upon submiting the form right? No problem.
Now we make things a little more difficult. With each field name I want to use [require] and [norequire] IE
<INPUT TYPE="text" name="[require][name]">
Thus on the next page it would show up as
an array $_POST[require][name] As well as bringing in the rest of the fields, under each array, require and norequire. ( I hate multidimensional arrays)
My question is, when bringing out the data in the array, how do I keep the New Array Order the same as the order it was submitted from the form?
IE.
<input type="text" name="[require][name]">
<input type="text" name="[norequire][email]">
<input type="text" name="[require][phone]">
<input type="text" name="[norequire][content]">
This order will show up in the array like this, with two seperate arrays:
[require] [name] => bob
[require] [phone] => 555-5555
[norequire] [email] => bob@555.com
[require] [phone] => 555-5555
[norequire] [content] => blah
Ideas or suggestions? Or is this not possible? Basically What im trying to do is create a universal function that will take any submited information and insert it into the database, this would not be a problem if i didn't want to do error checking, but the error checking and throwing me into multi-dimensional arrays kinda throws me way off... any ideas or suggestions would be greatly appreciated!! Thanks,
Drew
A Fun little challenege indeed, but I need to understand how arrays work first.