Jump to content

please help in swaping 3 images. with code


delickate

Recommended Posts

hi,

i've 3 image in same page.

image A,B,C from database.

i would like to swap these 3 images in click.i've images on page like.

  A

B    C

 

A on center

B on left side

C on right side

 

if i click on B it goes to A's place and A must positioned on B and atructure should be like

  B

A  C

then if i clike on C then B & C should swap like

  C

A  B

i dont need click on center image.just click on left or right image and they swap.can any one do fever me please?

my Code is:

<?

//from left

$cat_id=@$_REQUEST['catid'];

$set_id=@$_REQUEST['setid'];

$pid=@$_REQUEST['pid'];

//end from left

//from this

$moveleft=@$_REQUEST['moveleft'];

$moveright=@$_REQUEST['moveright'];

$movecenter=@$_REQUEST['movecenter'];

$_SESSION['foot']="";

//end from this

//from right

//$image=@$_SESSION['f'];

//$detail=@$_REQUEST['det'];

//end right

 

?>

 

<!-- main table -->

<?

$sql = "select * from tbl_product where cat_id='$cat_id'  and set_id='$set_id'";

$res = dbQuery($sql);

while ($row = dbFetchAssoc($res))

{  extract($row);

 

  if(isset($detail))

{

  /* $sql = "select * from tbl_categorydetail where p_id='$pid' and cd_largeimage='$image'";

$res = dbQuery($sql);

          $row = dbFetchAssoc($res);

list($image,$p_footballLargeimage)=array($p_footballLargeimage,$image); *///  $p_footballLargeimage=$image;

         

}

 

if(isset($moveleft))

{

  if($moveleft==$p_gloveSmallimage)

  {

    $swap1 = $p_gloveSmallimage;

$p_gloveSmallimage=$p_footballLargeimage;

$p_footballLargeimage=$swap1;

 

  }

  /* if($moveleft==$p_shinpadSmallimage)

  {

    $swap1 = $p_shinpadSmallimage;

$p_shinpadSmallimage=$p_gloveSmallimage;

$p_footballLargeimage=$swap1;

  }  */

 

}

if(isset($moveright))

{

  if($moveright==$p_shinpadSmallimage)

  {

    $swapr=$p_shinpadSmallimage;

$p_shinpadSmallimage=$p_footballLargeimage;

$p_footballLargeimage=$swapr;

  }

}

 

?>

 

<table cellpadding="0" cellspacing="0" border="0">

  <tr>

      <td colspan="2">

        <!-- head -->

        <table cellpadding="0" cellspacing="0" border="1">

          <tr>

              <td valign="bottom"><? echo $p_footballCode; ?></td>

              <td width="300" height="200">

                  <img src="<?  echo "../admin/Category List/".$p_footballLargeimage; $_SESSION['foot']=$p_footballLargeimage;?>" width="200" height="200" border="0" /></td>

              <td valign="top" width="140">

                  <table cellpadding="0" cellspacing="0" border="0">

                      <tr><td><b>Name: </b><? echo $p_name; ?></td></tr>

                      <tr><td><b>Description: </b><br /><? echo $p_footballDescription; ?></td></tr>

                  </table>

              </td>

          </tr>

        </table>

 

        <!-- end head -->

      </td>

  </tr>

  <tr><td colspan="2"> </td></tr>

  <tr><td colspan="2"><img src=" img/centerimg.jpg" width="433" height="8"></td></tr>

  <tr><td colspan="2"> </td></tr>

    <tr>

          <td>

          <!-- left -->

          <table cellpadding="0" cellspacing="0" border="1">

          <tr>

              <td valign="bottom"><? echo $p_gloveCode; ?></td>

              <td width="200" height="100">

                <a href="index.php?catid=<? echo $cat_id; ?>&setid=<? echo $set_id; ?>&pid=<? echo $p_id; ?>&moveleft=<? echo $p_gloveSmallimage; ?>" class="nav">

                  <img src="<?  echo "../admin/Category List/".$p_gloveSmallimage; ?>" width="100" height="100" border="0"  /></a></td>

          </tr>

        </table>

          <!-- end left --> 

          </td>

          <td>

          <!-- right -->

          <table cellpadding="0" cellspacing="0" border="1">

          <tr>

              <td valign="bottom"><? echo $p_shinpadeCode; ?></td>

              <td width="200" height="100">

                <a href="index.php?catid=<? echo $cat_id; ?>&setid=<? echo $set_id; ?>&pid=<? echo $p_id; ?>&moveright=<? echo $p_shinpadSmallimage; ?>" class="nav">

                  <img src="<?  echo "../admin/Category List/".$p_shinpadSmallimage; ?>" width="100" height="100" border="0" /></a></td>

          </tr>

        </table>

        <!-- end right -->

          </td>

    </tr>

 

</table>

<? } //end top while loop ?>

<!-- end main table -->

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.