Hi, I have stored 800 images in root/Images and store link in DB for reference along with another information. There is a search box through which I get all the info. For viewing images I used <a href=".$row['image']." target=_blank>".$row['ch']."</a> Ch value is click here to view.
Now I want that specific image in light box in same window. How its possible?
Here is my comple code.

<form action="sims_search_view2.php" method="post">

<input type="text" value="Enter Site ID" name="a" class="textfield_effect" maxlength="30" onfocus="this.value=''">
<input type="submit" style="width: 200px;
	height: 20px;
	cursor: pointer;
	border: none;
	margin-left:0px;
	background: transparent url(/images/sims_search_button.jpg) no-repeat 0 0;" value=""/>
</form>	</td>
</tr>

        </table>
<div>
  <?
  $con = mysql_connect("localhost","root","");
   if(!$con)
     {
     die('Could not connect: ' . mysql_error());
    }
   mysql_select_db("onm", $con);


 $ID=$_POST['a'];
 


$result = mysql_query("SELECT * FROM `info` WHERE code=$ID ");
 
 while($row = mysql_fetch_array($result))
  {
  


//$form=<<<POST
 echo "<table width=80% class=info align=center bgcolor=#FFFFFF >";
       echo "<tr>";
		echo "<td colspan=5  class=servHd>  Site Critical Information </td>";
			echo "<td  class=servHd>";
			echo " <form action=sims_update.php method=post>";
        	echo "<input type=hidden value=$ID name=siteid1 />";
       		echo "<input type=submit name=sub value=update />"; 
		    echo "</form>";
		    echo "</td>";

		echo "</tr>";        
				 echo  "<tr>";
                   echo  "<th >Complete SiteId</th>";
                    echo "<td >$row[0]</th>";
                    echo "<th >Alias</th>";
                    echo "<td >$row[1]</td>";
                    echo "<th >NewId</th>";
                    echo "<td >$row[3]</td>";
				  echo "</tr>";
                  echo "<tr>";
                    echo "<th >Longitude</th>";
                    echo "<td >$row[4]</th>";
                    echo "<th >Latitude</th>";
                    echo "<td >$row[5]</td>";
                    echo "<th >Region</th>";
                    echo "<td >$row[7]</td>";
				  echo "</tr>";
                  echo "<tr>";
                    echo "<th >City</th>";
                    echo "<td >$row[8]</th>";
                    echo "<th >Classification</th>";
                    echo "<td >$row[9]</td>";
                    echo "<th >Maintained By</th>";
                    echo "<td >$row[10]</td>";
				  echo "</tr>";
                 echo "<tr>";
                    echo "<th >Address</th>";
                    echo "<td colspan=3>$row[6]</th>";
					echo "<th >Image</th>";
                    echo "<td><a href=".$row['image']." target=_blank>".$row['ch']."</a></th>";
				  echo "</tr>";
				  

                 
				  
                 echo "</table>";


//POST;
//echo $form;
  }

download jscripts from these.
http://www.huddletogether.com/projects/lightbox2/

add below jscripts and css.

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

Add a rel="lightbox" attribute to any link tag to activate the lightbox. For example:

<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.