Forum Moderators: coopster
Say for example.. I had an array of plants. and then added a foreach loop to it.
How would the user input ( what methods- i need to see input examples_ to retrieve the information. sorry a bit confused..
$names[] = 'David';
$names[] = 'Marty';
$names[] = 'Debbie';
$names[] = 'Munchkin';
$names[] = 'Fluffy';
With the above, how does a user input which ones they like.. i hope i am explaining myself properly..
To add an element to an array:
$names[] = 'Jack'; or
array_push($names, 'Jack'); To retrieve an element from an array:
$value = $names[2]; To retrieve the key of the element with value 'Jack':
$key = array_search('Jack', $names);
ok for example.
<?php $dy = array ("21st ", "22nd ", "23rd ");
$mo = array ("Jan ", "Feb" ,"Mar ") ;
$yr = array ("2002", "2003", ","2004");
echo ($dy [ ].$mo [ ].$yr [ ]);
?>
If i wanted to do a HTML script for the above... what would could it look like to the user...
In order to help me understand arrays properly, i need to see how the user would see what to input and how the variable of the array would be presented to the user.