Hi! I'm new here, and I started learning php about 3 days ago, so I don't know very much. Anyway, I have an array which contains information on individual pictures I have in an image gallery.
The array format is as follows:
$images = array (
array ( 'name' => 'VOTES 2004 Poster',
'date' => '10.8.04',
'description' => "Promo poster for VOTES 2004, a nation-wide school mock election.",
'url' => "\"img/gallery/Votesposter.jpg\"",
'category' => 2 ),
array ( 'name' => 'VOTES 2004 Logo',
'date' => '10.8.04',
'description' => "Logos for a nation-wide school mock election.",
'url' => "\"img/gallery/Voteslogo.jpg\"",
'category' => 4 ),
and so on. There are about 12 arrays within the $images array. Now, I am trying to make a drop-down menu box thing, and each option in the box is the title of an image in the array. So, I logically (or so I thought) decided to use the array_walk function. I made the following function to be used in the array_walk:
function MenuBox($images)
{
echo '<option>' . $images[1]['name'] . '</option>';
}
Now see, the problem came when I didn't know what to put for the name of the first array (the number one in the above function). I tried to put current() in there, but later on I found out that array_walk doesn't actually move the array pointer, so that wouldn't work. What would I put in here in order to make the array walk work propperly?
Here's the code in which I actually use the array_walk function:
function Create_MenuBox($images)
{
print '<form action="http://somesite.com" method="post">';
print ' <select>';
array_walk($images, 'MenuBox');
print ' <select>';
print '</form>';
}
And the original site address is: http://orod.lanpirates.net/?img=0
The gallery system works fine, it's just the menu that I put at the bottom of the page that doesn't work. 😕
Any help would be greatly appreciated, and thanks in advance!