Results 1 to 3 of 3

Thread: Show & Hide Divs

  1. #1
    Join Date
    Jun 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Show & Hide Divs

    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

  2. #2
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    For sake of ease while debugging:

    PHP Code:
          <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>

  3. #3
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    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 . "'";

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •