jasonc Posted July 25, 2010 Share Posted July 25, 2010 I have created a new array... $newarray= array( 'name'=> array('formtype'=> 'ContactUs', 'screenloc'=> 'left', 'fieldid'=>'name', 'fieldtext'=> 'Your name*', 'DBfield'=> 'name'), 'email'=> array('formtype'=> 'ContactUs', 'screenloc'=> 'left', 'fieldid'=>'email', 'fieldtext'=> 'Your e-mail address*', 'DBfield'=> 'email'), 'checkEmailB'=> array('formtype'=> 'ContactUs', 'screenloc'=> 'left', 'fieldid'=>'checkEmailB', 'fieldtext'=> 'Re-type your email address*', 'DBfield'=> 'checkEmailB'), 'phone'=> array('formtype'=> 'ContactUs', 'screenloc'=> 'right', 'fieldid'=>'phone', 'fieldtext'=> 'Your phone number*', 'DBfield'=> 'phone'), 'message'=> array('formtype'=> 'ContactUs', 'screenloc'=> 'right', 'fieldid'=>'message', 'fieldtext'=> 'Your message*', 'DBfield'=> 'message') ); but do not know how to read the different sections of it so i can ready and construct only the 'contactus' parts thats are in the 'formtype' part of the array into the form. Link to comment https://forums.phpfreaks.com/topic/208832-how-to-read-only-one-section-of-array/ Share on other sites More sharing options...
phil88 Posted July 27, 2010 Share Posted July 27, 2010 Something along the lines of this? foreach($newarray as $item){ if($item['formtype'] == 'ContactUs'){ echo $item['screenloc']; # or whatever you want to do } } Link to comment https://forums.phpfreaks.com/topic/208832-how-to-read-only-one-section-of-array/#findComment-1091652 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.