I have most of this script figured out with help from different online articles and posts. So far I have
//begin insert image from uploads page part one
$dir = "members/".$userdata['username']."/";
if (file_exists($dir))
{
$dh = opendir($dir);
$a = '1';
$b = '1';
$c = '1';
$d = '1';
$image_type = array("jpg", "JPG", "gif", "GIF", "bmp", "BMP", "png", "PNG");
while (($file = readdir($dh)) !== false)
{
if ($file != "." && $file != "..")
{ $pics[] = $file; $a++;}
}
closedir($dh);
}
$a=($a-"2");
?>
<script language='javascript' type="text/javascript">
<!-- Hide script from older browsers
colorInfo = new Array
<?php
while ($b <= $a)
{
$pic = $pics[$b];
$pieces = explode(".", $pic);
$ext = $pieces[1];
if (in_array($ext, $image_type))
{
echo "colorInfo[$b] = ";
echo '"[img]http://www.abit-wolves.com/members/'.$userdata['username'].'/'.$pics[$b].'[/img]"'; echo "\n";
}
else
{
echo "colorInfo[$b] = ";
echo '"[url=http://www.abit-wolves.com/members/'.$userdata['username'].'/'.$pics[$b].']'.$pics[$b].'[/url]"'; echo "\n";
}
$b++;
}
?>
function showInfo(thisColor) {
document.post.message.value += colorInfo[thisColor]
}
// End hiding script from older browsers -->
</script>
That part works and displays something like
<script language='javascript' type="text/javascript">
<!-- Hide script from older browsers
colorInfo = new Array
colorInfo[1] = "[img]http://www.abit-wolves.com/members/Josh18657/DSCF0050.JPG[/img]"
colorInfo[2] = "[img]http://www.abit-wolves.com/members/Josh18657/30.JPG[/img]"
function showInfo(thisColor) {
document.post.message.value += colorInfo[thisColor]
}
// End hiding script from older browsers -->
</script>
then I can use a link like the following to add the text to the text form field
<a href="#" onClick="this.href='javascript:showInfo(2)'">30.JPG</a>
Now instead of having a list of links, one for each image in the array above, I'd like to make a drop down box that acomplishes the same thing, just neater.
Any help would be greatly apreciated.
Josh