Dear All,
What i need to do is add four thumbnails, which I can do using the code I have. But now I need to create a way in which I can swap the large image for the thumbnail images once there clicked. I have tried lots of ways and just can't get it working. Can some one help me insert the code i need.
One way I have tried is below.
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile1.jpg"><imgsrc="smallthumb1.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile2.jpg"><imgsrc="smallthumb2.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile3.jpg"><imgsrc="smallthumb3.jpg"></a>
<a href="nameofthumbnailpage.php?image=nameoflargeimagefile4.jpg"><imgsrc="smallthumb4.jpg"></a>
if(isset($_GET['image'])){
<img src="$_GET['image']">
}
else{
<img src="defaultimage.jpg">
}
echo "<img src='" . $_GET['image'] ."'>";
Here is the code which is pulling the correct images for the detials page of a property.
<?php
require 'listing.inc';
if (array_key_exists("propID", $_GET))
$propertyID = $_GET["propID"];
else
die("Sorry, cannot locate the details for that property");
$query = "SELECT Price, PropertyID, Area, MainDescription, Parking, cFacility1, cFacility2, cFacility3, cFacility4, ";
$query = $query . "cFacility5, cFacility6, cFacility9, PropertyName FROM listings WHERE PropertyID = '{$propertyID}';";
// Connect to the server
if (!($connection = @ mysql_connect($hostName, $userName, $password)))
die("Cannot connect to server {$hostName}");
// print '<div class="debug">Opening database</div>' . "\n";
// Select the database
if (!(mysql_select_db($databaseName, $connection)))
showDbError();
// print '<div class="debug">Issuing query</div>' . "\n";
if (!($result = @ mysql_query($query, $connection)))
showDbError();
if (!($record = @ mysql_fetch_array($result)))
die("Sorry, cannot locate the details for that property");
$imageFile = "photos/pBRANCH_{$record["PropertyID"]}.jpg";
$imageFile2 = "photos/aBRANCH_{$record["PropertyID"]}.jpg";
print " <tr>\n";
print ' <td height="277" width="411">' . "\n";
print ' <div align="center">' . "\n";
print " <img src=\"{$imageFile}\"";
print ' border="0" height="225" width="340" alt="Property photo" />' . "\n";
print " <img src=\"{$imageFile2}\"";
print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";
print " <img src=\"{$imageFile2}\"";
print ' border="0" height="60" width="80" alt="" />' . "\n";
print " <img src=\"{$imageFile}\"";
print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";
print " <img src=\"{$imageFile}\"";
print ' border="0" height="60" width="80" alt="Property photo" />' . "\n";
print " </div> </td>\n";
print ' <td valign="top" width="389"><p class="style5"><br>' . "\n";
print ' <span class="style6"><span class="style8">Property</span><span class="style7"><br>Details</span></span>' . "\n";
print ' <br><br><strong><br>Area:</strong>' . "\n";
print "{$record["PropertyName"]}<br><strong>Price:</strong><span class=\"style24\"> £{$record["Price"]} PCM</span>\n";
print " <br><br></p></td></tr>\n";
print ' <tr><td><table align="center" border="0" cellpadding="0" cellspacing="0" height="181" width="387">' . "\n";
print " <tr>\n";
print ' <td bgcolor="#547cad" width="44"> </td>' . "\n";
print ' <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
print "{$record["cFacility1"]}</span></td>\n";
print ' <td bgcolor="#547cad" width="190"><span class="style17">• ';
print "{$record["cFacility2"]}</span></td>\n";
print " </tr>\n";
print " <tr>\n";
print ' <td bgcolor="#547cad" width="44"> </td>' . "\n";
print ' <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
print "{$record["cFacility3"]}</span></td>\n";
print ' <td bgcolor="#547cad" width="190"><span class="style17">• ';
print "{$record["cFacility4"]}</span></td>\n";
print " </tr>\n";
print " <tr>\n";
print ' <td bgcolor="#547cad" width="44"> </td>' . "\n";
print ' <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
print "{$record["cFacility5"]}</span></td>\n";
print ' <td bgcolor="#547cad" width="190"><span class="style17">• ';
print "{$record["cFacility6"]}</span></td>\n";
print " </tr>\n";
print " <tr>\n";
print ' <td bgcolor="#547cad" width="44"> </td>' . "\n";
print ' <td bordercolor="#FFFFFF" bgcolor="#547cad" width="153"><span class="style17">• ';
print "{$record["cFacility9"]}</span></td>\n";
print ' <td bgcolor="#547cad" width="190"><span class="style17">• PARKING ';
print "{$record["Parking"]}</span></td>\n";
print " </tr>\n";
print " </table></td>\n";
print ' <td><p class="style5" align="justify"><strong>Main Description: </strong><br><br>' . "\n";
print "{$record["MainDescription"]}\n";
print ' </p><p class="style9"> <a href="mailto:info@hslettings.com?subject=';
print "{$record["PropertyName"]}";
print '">REGISTER INTEREST </a></p></td>' . "\n";
print " </tr>\n";
?>