I'm new to PHP and I'm using an Image Swapper and need to be able to have multiple galleries on the same page. It will call up the first gallery just fine but when I get to the second gallery, it won't call the images. I know I need to be able to define different galleries on click but I have no idea how to do that.

page is: http://katiehaledesign.com/index.php...logos-branding

Thanks in advance.

first gallery
PHP Code:
<?php
$imagesArray
["src"][0]="images/bckspiceoutlines-4.jpg";
$imagesArray["alt"][0]="bksp1";
$imagesArray["a"][0]="images/bckspiceoutlines-4.jpg"
$imagesArray["src"][1]="images/bckspiceoutlines-5.jpg";
$imagesArray["alt"][1]="bkspl2";
$imagesArray["a"][1]="images/bckspiceoutlines-5.jpg";
$imagesArray["src"][2]="images/blackspice3-30-3.jpg";
$imagesArray["alt"][2]="bksp3";
$imagesArray["a"][2]="images/blackspice3-30-3.jpg";

$imagesArray["src"][3]="images/blackspice3-30-4.jpg";

$imagesArray["alt"][3]="bksp3";
$imagesArray["a"][3]="images/blackspice3-30-4.jpg";

$imagesArray["src"][4]="images/blackspice3-30-6.jpg";

$imagesArray["alt"][4]="bksp4";
$imagesArray["a"][4]="images/blackspice3-30-6.jpg";

$imagesArray["src"][5]="images/blackspice3-30-5.jpg";

$imagesArray["alt"][5]="bksp5";
$imagesArray["a"][5]="images/blackspice3-30-5.jpg";

$imagesArray["src"][6]="images/blackspice3-30-8.jpg";

$imagesArray["alt"][6]="bksp6";
$imagesArray["a"][6]="images/blackspice3-30-8.jpg";

$imagesArray["src"][7]="images/blackspice3-30-9.jpg";

$imagesArray["alt"][7]="bksp7";
$imagesArray["a"][7]="images/blackspice3-30-9.jpg";

$imagesArray["src"][8]="images/blackspice3-30-2.jpg";

$imagesArray["alt"][8]="bksp8";
$imagesArray["a"][8]="images/blackspice3-30-2.jpg";

 

$imagesArray["src"][9]="images/blackspice3-30-1.jpg";

 

$imagesArray["alt"][9]="bksp9";
$imagesArray["a"][9]="images/blackspice3-30-1.jpg";

 

$useImage=0// set default image value (equal to array index number)
if(isset($_REQUEST)){
while(list(
$key,$val)=each($_REQUEST)){
if(
strstr($key,"_img_x")){
$useImage=str_replace("_img_x","",$key);
break;}}}
?>
<form method="post" action="<?=$_SERVER["PHP_SELF"]?>" id="imageSwapperForm" onsubmit="return false">
<br><br><p><a href="<?=$imagesArray["a"]?>" TARGET="_blank"><img id="img" src="<?=$imagesArray["src"][$useImage]?>" width="auto" height="auto" border="0" alt="<?=$imagesArray["alt"][$useImage]?>" /></a></p>
<br><br><br><?
for($i=0$i count($imagesArray["src"]); $i++){
echo 
'<input type="image" name="'.$i.'_img" value="'.$i.'_img" src="'.$imagesArray["src"][$i].'" alt="'.$imagesArray["alt"][$i].'" style="width:100px;height:60px;padding:1px" onclick="document.getElementById(\'img\').src=this.src; document.getElementById(\'img\').alt=this.alt; document.getElementById(\'img\').href=this.href" />';
}
?>
second gallery
PHP Code:
<?php
$imagesArray
["src"][0]="images/spiritedartcolor.png";
$imagesArray["alt"][0]="SP1";
$imagesArray["a"][0]="images/spiritedartcolor.png"
$imagesArray["src"][1]="images/spiritedartlogo2.png";
$imagesArray["alt"][1]="SP2";
$imagesArray["a"][1]="images/spiritedartlogo2.png";
$imagesArray["src"][2]="images/spiritedartlogo7.png";
$imagesArray["alt"][2]="sp3";
$imagesArray["a"][2]="images/spiritedartlogo7.png";

$imagesArray["src"][3]="images/spiritedartlogobox3.png";

$imagesArray["alt"][3]="sp4";
$imagesArray["a"][3]="images/spiritedartlogobox3.png";

$imagesArray["src"][4]="images/spiritedartwinebottle.png";

$imagesArray["alt"][4]="sp5";
$imagesArray["a"][4]="images/spiritedartwinebottle.png";

$imagesArray["src"][5]="images/myspiritedartspill.png";

$imagesArray["alt"][5]="Sp6";
$imagesArray["a"][5]="images/myspiritedartspill.png";

$imagesArray["src"][6]="images/myspiritedartspillB&W-1.png";

$imagesArray["alt"][6]="bksp7";
$imagesArray["a"][6]="images/myspiritedartspillB&W-1.png";



 

$useImage=0// set default image value (equal to array index number)
if(isset($_REQUEST)){
while(list(
$key,$val)=each($_REQUEST)){
if(
strstr($key,"_img_x")){
$useImage=str_replace("_img_x","",$key);
break;}}}
?>
<form method="post" action="<?=$_SERVER["PHP_SELF"]?>" id="imageSwapperForm" onsubmit="return false">
<br><br><p><a href="<?=$imagesArray["a"]?>" TARGET="_blank"><img id="img" src="<?=$imagesArray["src"][$useImage]?>" width="auto" height="auto" border="0" alt="<?=$imagesArray["alt"][$useImage]?>" /></a></p>
<br><br><br><?
for($i=0$i count($imagesArray["src"]); $i++){
echo 
'<input type="image" name="'.$i.'_img" value="'.$i.'_img" src="'.$imagesArray["src"][$i].'" alt="'.$imagesArray["alt"][$i].'" style="width:100px;height:60px;padding:1px" onclick="document.getElementById(\'img\').src=this.src; document.getElementById(\'img\').alt=this.alt; document.getElementById(\'img\').href=this.href" />';
}
?>