Log in

View Full Version : Show & Hide Divs



kathycam
05-13-2012, 07:15 PM
Hello

I have attached a part of my code that I am having difficulty getting to work.

I am reading a field from my database to see if a link to an image is present, and if it is, then I want to display the image.

If not, then I have some code that allows the user to draw in their signature.

I thought my code would work, but it isn't showing up.

Thanks

ApacheTech
05-13-2012, 11:54 PM
For sake of ease while debugging:



<br/>
<table border="0" class="table-inner">
<tr>
<td width="10">&nbsp;</td>

<td width="160">
<!-- (2) INITIAL - DAMAGES -->
<?php
$sQuery = "SELECT * FROM signatures WHERE `web-order-num` = \"$sWebOrderNum\" ";
$iResult = mysql_query ($sQuery);
$iRow = mysql_fetch_assoc($iResult);
$sTempDmg = $iRow["initial-damages"];

if (strlen($sTempDmg) > 0)
{
$sTempImg = IMAGE_PATH . $sTempDmg;
print ("<img src='$sTempImg' />");
}
else
{
?>
<div id='ctlSignatureDamages_Container' style='width:130px;height:50px;margin:0px;'>
<script language="javascript" type="text/javascript">
var ieVer = getInternetExplorerVersion();
if (isIE)
{
if (ieVer >= 9.0)
isIE = false;
}

if (isIE)
{
document.write("<div ID='ctlSignatureDamages' name='ctlSignatureDamages'
style='width:130px;height:50px;border:Dashed 2px #DDDDDD'; z-index:9999'></div>");
}
else
{
document.write("<canvas ID='ctlSignatureDamages' name='ctlSignatureDamages'
width='130' height='50'></canvas>");
}
</script>
</div>
<?php
}
?>
</td>

<td align="left" valign="top">
<b><u>Damages (Pets & Kids) (initial at left)</u></b>
<br/>
Our Company holds no responsibility for damage in and around the work site.
Please keep kids and animals inside or away from our active work site.<br/>
We will inform you of the scheduling.
</td>

<td width="10">&nbsp;</td>
</tr>

ApacheTech
05-14-2012, 12:02 AM
Is the SQL working?

The first thing I can see off the bat is a possible error in the SELECT statement, but I'm not fully up on PHP syntax.

REPLACE: $sQuery = "SELECT * FROM signatures WHERE `web-order-num` = \"$sWebOrderNum\" ";

WITH: $sQuery = "SELECT * FROM signatures WHERE `web-order-num` = '" . $sWebOrderNum . "'";