View Single Post
Old 06-10-2009, 12:23 PM   #3 (permalink)
Schroder
The Wanderer
 
Schroder's Avatar
 
Join Date: Mar 2008
Posts: 20
Thanks: 0
Schroder is on a distinguished road
Default

If I'm understanding the problem correctly, I think the issue is in this section of code:

PHP Code:
    // if file $format equal 1
    
if ($format "1") {
// add it to portrait list
    
$portrait .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$path."".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$portrait .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$portrait .= "<img src=\"".$path."".$file."/".$value."\" /><br />".$value."<br/></div>";
    }
    
// if  file $format equal 0    
    
if ($format "0") {
    
$landscape .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$landscape .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$landscape .= "<img src=\"".$file."/".$value."\" /><br />".$value."<br/></div>";
    
    }
    
    
// if  file $format equal 2    
    
if ($format "2") {
    
$panoramic .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$panoramic .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$panoramic .= "<img src=\"".$file."/".$value."\" /><br />".$value."<br/></div>";
    
    }
  
// Else, do nothing
    
}else{
        
        
        } 
An assignment operator (=) is being used instead of a comparison (==), so the 1, 2 and 3 are being assigned to $format. There is no error returned because this is still valid, and it will return true.

Below is how it probably should look:
PHP Code:
    // if file $format equal 1
    
if ($format == "1") {
// add it to portrait list
    
$portrait .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$path."".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$portrait .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$portrait .= "<img src=\"".$path."".$file."/".$value."\" /><br />".$value."<br/></div>";
    }
    
// if  file $format equal 0    
    
if ($format == "0") {
    
$landscape .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$landscape .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$landscape .= "<img src=\"".$file."/".$value."\" /><br />".$value."<br/></div>";
    
    }
    
    
// if  file $format equal 2    
    
if ($format == "2") {
    
$panoramic .= "<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$file."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    
$panoramic .= "<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    
$panoramic .= "<img src=\"".$file."/".$value."\" /><br />".$value."<br/></div>";
    
    }
  
// Else, do nothing
    
}else{
        
        
        } 
Schroder is offline  
Reply With Quote