assign array values to variables
| From: | PJ | Date: | Sat, 07 Mar 2009 15:21:05 +0000 |
| Subject: | assign array values to variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-289549@lists.php.net to get a copy of this message | ||
Seems it should be simple, but how does one extract values from an array
and assign them to a variable?
foreach ($categoriesIN as $category) {
echo "$category<br>";
}
or
if(!empty($_POST['categoriesIN'])){
foreach( $_POST['categoriesIN'] as $key => $value) {
echo "value = $value<br>";
}
both show the values entered in the form but do not create a variable.
Since the number of entries will vary, I cannot assign a number of
variable names before knowing how many entries there may be.
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php