jasonc Posted July 25, 2010 Share Posted July 25, 2010 I have many forms each with many fields. I wish to simplify the alteration of these as the process is long winded (edit form, update each line, edit return page file and so on. I have a function that will create the forms and one to read the info sent. What I am having problems with is creating the array with all the form data fields and id's and names. I am wishing to use a simple method say... $array[contactusform][name][fieldid] (which would return say 'name' which would be the fieldid) $array[contactusform][name][fieldtext] (which would return say 'Please enter you name*' which would be the text shown beside the text field) and so on.. can anyone suggest a way to do this in a single array, as i am currently having each form in a seperate array which is now not going to work with new features i wish to introduce the to site. Link to comment https://forums.phpfreaks.com/topic/208834-need-help-to-contruct-multi-level-array/ Share on other sites More sharing options...
awjudd Posted July 25, 2010 Share Posted July 25, 2010 How about something like this? $arr = array ( 'contactusform' => array ( 'field1' => array ( 'fieldid' => 'nameField', 'fieldtext' => 'Name' ), 'field2' => array ( 'fieldid' => 'nextField', 'fieldtext' => 'stuff here' ) ); ~juddster Link to comment https://forums.phpfreaks.com/topic/208834-need-help-to-contruct-multi-level-array/#findComment-1090923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.