> Just make $item a 2-dimensional array, with the first diemnsion addressed by 
> $count; so:
>
>   $item[$count][] = $_POST['phone'];
>   $item[$count][] = $_POST['category'];
>   $item[$count][] = $_POST['copy'];
>   $item[$count][] = $_POST['pic_style'];
>   $item[$count][] = $cost;
>   $item[$count][] = $image;
>
>   $count += 1;
>
>   $item[$count][] = ...;
>   $item[$count][] = ...;
>   // etc.
>
> Incorporating the (good) advice to use $_SESSION, this becomes:
>
>   $_SESSION['item'][$count][] = $_POST['phone'];
>   $_SESSION['item'][$count][] = $_POST['category'];
>   $_SESSION['item'][$count][] = $_POST['copy'];
>   $_SESSION['item'][$count][] = $_POST['pic_style'];
>   $_SESSION['item'][$count][] = $cost;
>   $_SESSION['item'][$count][] = $image;
>
>   $count += 1;
>
>   $_SESSION['item'][$count][] = ...;
>   $_SESSION['item'][$count][] = ...;
>   // etc.
>
>
> Personally, I'd be inclined to use string indexes that indicate what's in 
> each element, to avoid having to remember somehow which numeric index 
> corresponds to which attribute; so:
>
>   $_SESSION['item'][$count]['phone'] = $_POST['phone'];
>   $_SESSION['item'][$count]['category'] = $_POST['category'];
>   $_SESSION['item'][$count]['copy'] = $_POST['copy'];
>   $_SESSION['item'][$count]['pic_style'] = $_POST['pic_style'];
>   $_SESSION['item'][$count]['cost'] = $cost;
>   $_SESSION['item'][$count]['image'] = $image;
>
>   $count += 1;
>
>   $_SESSION['item'][$count]['phone'] = ...;
>   $_SESSION['item'][$count]['category'] = ...;
>   // etc.
>

 Thanks for all the help guys. I now have a better understanding of multi
dimensional arrays and can use it for what I'm trying to accomplish. This
list is the greatest!!

Thanks,

Ed

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to