Array Help?
Posted: Mon Dec 16, 2002 2:49 pm
Hey all, I'm trying to get my form to work as a multidemensional array. Basically I display a list of categories on a form and the user can update them all at the same time.
So I want to take 3 columns and turn them into one array element of a multidim. array
here is what I have so far but its not working right
its not creating the assoc array correctly. Anyone have any tips on how to do this? thanks!
p.s. here is the output I get from print_r. As you can see its not right
Array ( [0] => Array ( [catid] => Array ( [0] => 2801 [1] => 2802 [2] => [3] => [4] => ) [catname] => Array ( [0] => Video Tape [1] => Audio Tape [2] => [3] => [4] => ) [sortorder] => Array ( [0] => 10 [1] => 20 [2] => [3] => [4] => ) ) )
So I want to take 3 columns and turn them into one array element of a multidim. array
here is what I have so far but its not working right
Code: Select all
$arraytot = count($_POST['f_catid']);
for($i=0; $i < $arraytot; $i++)
{
$newline = array(
array(catid => $_POST['f_catid'],
catname => $_POST['f_catname'],
sortorder => $_POST['f_sort']),
);
}
echo '<BR><BR><BR>'.print_r($newline);its not creating the assoc array correctly. Anyone have any tips on how to do this? thanks!
p.s. here is the output I get from print_r. As you can see its not right
Array ( [0] => Array ( [catid] => Array ( [0] => 2801 [1] => 2802 [2] => [3] => [4] => ) [catname] => Array ( [0] => Video Tape [1] => Audio Tape [2] => [3] => [4] => ) [sortorder] => Array ( [0] => 10 [1] => 20 [2] => [3] => [4] => ) ) )