Link to home
Start Free TrialLog in
Avatar of dbetts
dbetts

asked on

Some onClick() events not firing on PHP generated HTML

I have a php page with three main sections.  Php generates all of the HTML for sections two and three with the echo(); command after variables are passed from the database.

Section one is just the meta tags, headers, style, etc.

Section two creates buttons and displays data.  The buttons are created via this command:
echo("<input style=\"background-image:url(../images/pencil.gif); width:21px; height:20; border:0px; cursor: hand;\" name=edit".$info['lenderid']." type=button value='' onClick=\"openEdits(lendersArray,'".$info['lenderid']."','ala".$info['lenderid']."');\">");

There are four buttons generated per record returned from the DB and there are typically about 20-30 records returned.  All buttons for all records are identical as the HTML is generated in a WHILE LOOP.

Section three creates <div></div> tags with a table and form inside that allow for modification of the records in section two. These are visible or hidden based on onClick() javascript events fired from section two.

Okay, now for the strange part...When I load the page, imagine that there is a virtual horizontal line 70cm (3") down from the top of the browser.  NONE of the buttons ABOVE that line fire the onClick() event.  It doesn't matter if I only return 2-6 records, or 50 records, tha same issue exists.
Now, if I comment out section two so that it doesn't get generated, ALL the buttons work as expected.

It seems to me that the system is going along generating the page, it gets started on section one stuff, but stops to see what's going on in section two, likes that better so it completes section two, then comes back to section one, only it ALWAYS forgets where it was and starts 70cm (3") below the top of the browser to begin implementing the onClick() events.

I realalize that the server doesn't have a personality, but that is the best way I can think of to explain the situation.  Anyone have any ideas?  If you need the code, I can email it or post the lot of it here.

Thanks,
Derrick
Avatar of eeBlueShadow
eeBlueShadow

Hi,

can you put an alert() at the start of the openEdits() function and confirm that the event isn't firing please.

Also, test in a different browser such as Mozilla (you didn't specify but I assume you're talking about IE here)

Exactly how many records don't work? 7cm is a strange unit to use ;) - and I guess you mean 7cm rather than 70cm (30")

Thanks, hope we can sort this quickly.
_Blue
Avatar of dbetts

ASKER

Oops.  I do mean 70mm, 3".

I tried it in Netscape and the onClick events DO fire for ALL the buttons, however, the "hand" cursor does NOT show when the mouse is over any of the buttons.

The alert(); I placed in the openEdits does NOT fire on those top few buttons in IE.

Thanks for looking into this,
Derrick
shouldn't it be

hand;\" name=edit".$info['lenderid']." type=button value='' onClick=\"openEdits(lendersArray,'".$info['lenderid']."','ala".$info['lenderid']."');\">");
hand;\" name=edit".$info['lenderid']." type=button value=\"\" onClick=\"openEdits(lendersArray,'".$info['lenderid']."','ala".$info['lenderid']."');\">");

? ie in HTML use double quotes
Sorry, I didn't see your first reply.

Regarding the hand: cursor:hand is a Microsoft CSS rule, the official version is cursor:pointer. However, since you need hand to work on some IE browsers, declare your CSS like
.myclass {
    cursor: pointer;
    cursor: hand;
}
*with pointer first - important*

A couple of points about your PHP which shouldn't affect the result, but hey, you never know ;)

echo "Some text then ".$p['a_var']." then more text";
=
echo "Some text then {$p['a_var']} then more text";

which can cut down on your quote usage. Also, attribute values in HTML only need to be surrounded by quotes when they have non alphanumeric charaters in, but it's never a bad idea to put them in all the time.

Could you view the source of your HTML page and copy/paste the HTML for a button which works, and for one which doesn't please? Also the openEdits function might be useful, if you're ok to paste that as well :)

_Blue
Avatar of dbetts

ASKER

There is quite a bit.  I am going to list the page's HTML/PHP code in its three sections in three posts:

Section One:

<?php
require '../Connections/db_gl_connect.php';
if ($logged_in == 0) {
      die('Sorry you are not logged in, this area is restricted to registered agents. <a href="agent_login.php">Click here</a> to log in.');
$db_object->disconnect();
}
$prefstate = $_COOKIE['prefstate'];

if (isset($_POST['submit'])) { // if data on form is to be saved...
      function numericOnly($string) { //function to strip characters other than numerals from a string    
          $numString = ereg_replace("[^[:digit:]]", "", $string);
          return $numString;
      }

      $listnumber = $_POST['idnumber'];
      //Pull all of the selected states from the post...
      $msgid = 'sentmsg'.$listnumber;
      $msg = $_POST[$msgid];
      $aData = split(";",$msg);
      
      $s = 'DELETE FROM lender_states WHERE lenderid = '.$listnumber.';';
      for ( $i = 0; $i < count($aData); $i++ ) {
            $thisVar = split(":",$aData[$i]);
            $postName = $thisVar[0];
            $postValue = $thisVar[1];
            
            $length = strlen($postValue);
            if ($length > 3) {
                  $value = substr($postValue,0,strlen($postValue)-3);
                  $s .= "INSERT INTO lender_states (lenderid, state) Values (".$listnumber.", '".$value."');";      
            }
      }
      
      $sql = $db_object->query($s);
      if (DB::isError($sql)) {
            die($s." ".$sql->getMessage());
      }
      
      $date = date('m d, Y');
      $table_name = 'lenderinfo';
      
      if ($listnumber == 'abc') {
            $cr=chr(0x0D); //search for all LFCR  and replace with <br />
    $lf=chr(0x0A);
            $programs = str_replace($cr.$lf, "<br />", $_POST['programsL']);
            $fields_values = array(
                  'company' => $_POST['companyL'],
                  'phone' => numericOnly($_POST['phoneL']), //Strip everything but the numbers....
                  'ext' => numericOnly($_POST['extL']),
                  'cellphone' => numericOnly($_POST['cellphoneL']),
                  'fax' => numericOnly($_POST['faxL']),
                  'email' => $_POST['emailL'],
                  'programs' => $programs,
                  'firstname' => $_POST['firstnameL'],  
                  'lastname' => $_POST['lastnameL'],
                  'address' => $_POST['addressL'],
                  'city' => $_POST['cityL'],
                  'state' => $_POST['stateL'],
                  'zip' => $_POST['zipL'],
                  'lenderstation' => $_SESSION['busunit']
                  );
            
            $res = $db_object->autoExecute($table_name, $fields_values, DB_AUTOQUERY_INSERT);                        
            if (DB::isError($res)) {
                  die($res->getMessage());
            }
      }
      else {
            $cr=chr(0x0D); //search for all LFCR  and replace with \n\r
    $lf=chr(0x0A);
            $programs = str_replace($cr.$lf, "<br />",$_POST['programs'.$listnumber]);      

            $fields_values = array(
                  'company' => $_POST['company'.$listnumber],
                  'phone' => numericOnly($_POST['phone'.$listnumber]), //Strip everything but the numbers....
                  'ext' => numericOnly($_POST['ext'.$listnumber]),
                  'cellphone' => numericOnly($_POST['cellphone'.$listnumber]),
                  'fax' => numericOnly($_POST['fax'.$listnumber]),
                  'email' => $_POST['email'.$listnumber],
                  'programs' => $programs,
                  'firstname' => $_POST['firstname'.$listnumber],  
                  'lastname' => $_POST['lastname'.$listnumber],
                  'address' => $_POST['address'.$listnumber],
                  'city' => $_POST['city'.$listnumber],
                  'state' => $_POST['state'.$listnumber],
                  'zip' => $_POST['zip'.$listnumber],
                  'lenderstation' => $_SESSION['busunit']
                  );
            
            $res = $db_object->autoExecute($table_name, $fields_values, DB_AUTOQUERY_UPDATE, 'lenderid = '.$listnumber);                        
            if (DB::isError($res)) {
                  die($res->getMessage());
            }
      }
      $db_object->disconnect();

      echo("<script language='javascript' type='text/javascript'>
                  window.location.href = 'https://secure.EvergreenMortgageInc.com/agents/applenders.php';
                  </script>");

} else {      // if form hasn't been submitted
      if (($prefstate != '') && ($prefstate != '*All*')) {
            $sql = "SELECT * FROM lenderinfo WHERE lenderstation = '".$_SESSION['busunit']."'
                                          AND lenderid in (SELECT lenderid FROM lender_states WHERE state = '".$prefstate."')
                                    ORDER BY status,company";
      } else {
            $sql = "SELECT * FROM lenderinfo WHERE lenderstation = '".$_SESSION['busunit']."' ORDER BY status,company";
      }
      $check = $db_object->query($sql);
      if (DB::isError($check)) {
            echo("<script language='javascript' type='text/javascript'>
                  alert('There was an error opening the Approved Lenders data.\\nPlease login again');
                  window.location.href = 'https://secure.EvergreenMortgageInc.com/agents/agent_login.php';
                  </script>");
            die($check->getMessage());
      }
function formatPhone($phone) {
      if (empty($phone)) return "";
      sscanf($phone, "%3d%3d%4s", $area, $prefix, $exchange);
      $out = @$area ? "($area) " : "";
      $out .= $prefix . '-' . $exchange;
      return $out;
}
function getGlyph($value) {
      $hrd = round(($value*2), 0)/2;
      if ($hrd == 0.5) {
            $glyphname = "0_5.gif";
      }
      elseif ($hrd == 1) {
            $glyphname = "1.gif";
      }
      elseif ($hrd == 1.5) {
            $glyphname = "1_5.gif";
      }
      elseif ($hrd == 2) {
            $glyphname = "2.gif";      
      }
      elseif ($hrd == 2.5) {
            $glyphname = "2_5.gif";      
      }
      elseif ($hrd == 3) {
            $glyphname = "3.gif";      
      }
      elseif ($hrd == 3.5) {
            $glyphname = "3_5.gif";      
      }
      elseif ($hrd == 4) {
            $glyphname = "4.gif";      
      }
      elseif ($hrd == 4.5) {
            $glyphname = "4_5.gif";      
      }
      elseif ($hrd == 5) {
            $glyphname = "5.gif";      
      }
      else {
            $glyphname = "unrated.gif";      
      }
      return $glyphname;
}

?>
<html><!-- InstanceBegin template="/Templates/Secure_Sub_Agents.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Evergreen Mortgage Inc.</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<link href="../css/evergreen.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../scripts/applenders.js" type="text/javascript"></script>
<?php
echo("
<script language='JavaScript'>
      var lendersArray=new Array();\n");
            while ($info = $check->fetchRow()) {                        
            echo("lendersArray[lendersArray.length] = 'ala".$info['lenderid']."';\n");
      }
      echo("
      lendersArray[lendersArray.length] = 'addLender';\n
</script>");
?>
<style type="text/css">
<!--
iframe {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-style: normal;
      border: 1px solid;
      position: relative;
      height: 63px;
      width: 103px;
}
-->
</style>
<!-- InstanceEndEditable -->
<script language="JavaScript" type="text/javascript" src="../scripts/secure_agents.js"></script>
<SCRIPT>
function getTag(el,str) {
      while ((el!=null) && (str.indexOf(el.tagName + ":")<0))
            el = el.parentElement
      return el
}

function navigateTo(sURL,target) {
        if ((target == '_self') || (target=="")) {
            window.location.replace(sURL);
            return false;
      }
      if (target == '_top') {
            top.window.location.replace(sURL);
            return false
      }
      if (target =='_parent') {
            parent.window.location.replace(sURL);
            return false;
      }
      if (target == '_blank' || parent.frames.length < 1) {
            window.open(sURL, target);
                return false;
      }
      else {
            if (parent.frames[target])
                  parent.frames[target].location.replace(sURL);
                else
                  window.open(sURL, target);
                return false;
      }
}

function checkIEClick() {
      var el = getTag(event.srcElement,"A:AREA:")
      if ((el!=null) && ((el.tagName=="A") || (el.tagName=="AREA"))) {
            event.returnValue = false
            navigateTo(el.href,String(el.target).toLowerCase())
      }
}

function checkNSClick(ev) {
      if (ev.target.href) {
            navigateTo(ev.target.href,String(ev.target).toLowerCase())
            return false
      }

}

if ((document.all) || (document.layers))
      if (document.layers) {
            document.captureEvents(Event.CLICK)
            document.onclick = checkNSClick
      }
      else
            document.onclick = checkIEClick
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<!-- InstanceBeginEditable name="Body_Script" --><!-- InstanceEndEditable -->
<table width=800 border=0 cellspacing=0 cellpadding=0>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="2"></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/top_bar.gif" width="800" height="12"></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="2"></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="4"></td>
  </tr>
  <tr>
    <td align="center" valign="middle"><img src="../images/logo.gif" width="174" height="64" hspace="13"></td>
            <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
            <td bgcolor="#909B8E"><!-- InstanceBeginEditable name="Page Header" --><img src="../images/top_shadow.gif" width="594" height="75"><!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td><img src="../images/spacer.gif" width="1" height="2"></td>
            <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
            <td><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td><img src="../images/spacer.gif" width="200" height="2"></td>
    <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
    <td><img src="../images/spacer.gif" width="596" height="1"></td>
  </tr>
  <tr valign="top">      
    <td background="../images/menu_2_divider.gif">
      <table border="0" cellpadding="0" cellspacing="0" background="../images/menu_background4.gif">
            <tr>
                          <td>
                              <table border="0" cellpadding="0" cellspacing="0">
              <!-- InstanceBeginEditable name="Side Menu" -->
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="176" height="60"></td>
                <td rowspan="11"><img src="../images/spacer.gif" width="24" height="1"></td>
              </tr>
              <!-- InstanceEndEditable -->
              <tr>
                <td colspan="2" align="right"><a href="http://www.EvergreenMortgageInc.com"><img src="../images/home.gif" width="40" height="16" border="0"></a></td>
              </tr>
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="1" height="7"></td>
              </tr>
              <tr>
                <td colspan="2" align="right"><a href="agentsmain.php"><img src="../images/agents_main.gif" width="91" height="16" border="0"></a></td>
              </tr>
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="1" height="8"></td>
              </tr>
              <tr><td>
                                          <div align="right" id=Outline name=Outline>
                                          <img src="../images/welcome.gif" alt="Welcome" width="48" height="17" id=Out1a style="cursor: hand" class="Outline"><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out1 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out1d style="display:None">
                                                      <A href='welcome.html'><img src="../images/welcome_sub.gif" alt="Welcome Agents" width="40" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                      <A href='successful_agent.html'><img src="../images/welcome_successful.gif" alt="How to be a successful Agent" width="135" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                      <A href='manage_loans.html'><img src="../images/welcome_manage.gif" alt="How to manage your loans" width="125" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>                                          
                                          <img src="../images/prospect_list.gif" alt="Prospect List" width="68" height="17" id=Out2a style="cursor: hand" class="Outline"><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out2 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out2d style="display:None">
                                                      <A href='prospect_list.php'><img src="../images/prospect_list_sub.gif" alt="Prospect List" width="57" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                  <A href='phone_script.html' target="_blank"><img src="../images/prospect_script.gif" alt="Phone Script" width="56" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>
                                          <img src="../images/matrix.gif" alt="Open a Matrix" width="76" height="17" id=Out3a style="cursor: hand" class="Outline" border=0><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out3 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out3d style="display:None">
                                                      <A href='open_matrix.php'><img src="../images/open_matrix_sub.gif" alt="Open a Matrix" width="63" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                  <A href='print_matrix.html' target="_blank"><img src="../images/print_matrix.gif" alt="Print a Blank Matrix" width="88" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>
                                          <A href="lender_replies.php"><img src="../images/lender_replies.gif" alt="Lender Replies" width="78" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="applenders.php"><img src="../images/applenders.gif" alt="Approved Lenders" width="96" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="forum/"><img src="../images/forum.gif" alt="Agent's Forum" width="77" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="download.php"><img src="../images/downloads.gif" alt="Agent's Forum" width="60" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="lifeplan.html"><img src="../images/lifeplan.gif" alt="Agent's Forum" width="47" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="logout.php"><img src="../images/logout.gif" alt="Agent's Forum" width="40" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                    </div></td>
                                    </tr>
                              </table>
                        </td>
                  </tr>
            </table>
            <script language="JavaScript">Outline.onclick=doOutline</script>
            </td>    
    <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=250></td>
            <td valign="top" background="../images/bkGrnd.gif">
            <table border="0" cellspacing="0" cellpadding="0">
                  <tr bgcolor="#FFFFFF">
                        <td colspan="5"><img src="../images/spacer.gif" width="1" height="20"></td>
                  </tr>
                  <tr>
                        <td><img src="../images/spacer.gif" width="20" height="6"></td>
                        <td><img src="../images/spacer.gif" width="7" height="1"></td>
                        <td><img src="../images/spacer.gif" width="4" height="1"></td>
                        <td><img src="../images/spacer.gif" width="545" height="1"></td>
                        <td><img src="../images/spacer.gif" width="20" height="1"></td>
                  </tr>
                  <tr>
                        <td><img src="../images/spacer.gif" width="20" height="1"></td>
                          <td colspan="3"><!-- InstanceBeginEditable name="Page SubHeader" --><img src="../images/approved_lenders_header.gif" width="267" height="21"><!-- InstanceEndEditable --></td>
                        <td rowspan="4"><img src="../images/spacer.gif" width="20" height="1"></td>
                  </tr>
                  <tr>
                        <td rowspan="3"><img src="../images/spacer.gif" width="20" height="1"></td>
                        <td valign="top"><img src="../images/page_linerV.gif" width="7" height="102"></td>          
                        <td><img src="../images/spacer.gif" width="10" height="1"></td>
                        <!-- InstanceBeginEditable name="Main Text" -->
                        <td valign="top">
                              <?php include('applenders_sub.php'); ?>
                        </td>
                        <!-- InstanceEndEditable --></tr>
            </table></td>
      </tr>
  <tr>
            <td background="../images/menu_2_divider.gif"><img src="../images/spacer.gif" width="1" height="4"></td>
            <td colspan="2"><img src="../images/spacer.gif" width=1 height=1></td>
  </tr>
      <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
      <tr>
    <td background="../images/menu_2_divider.gif"><img src="../images/spacer.gif" width="1" height="68"></td>
            <td colspan="2"><img src="../images/spacer.gif" width=1 height=1></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="4"></td>
  </tr>
  <tr>
    <td colspan="3" align="center" background="../images/bottom_bar.gif"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/our_promise.html"><img src="../images/our_promise2.gif" width="69" height="14" hspace="21" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="../clients/client_login.php"><img src="../images/client_login2.gif" width="68" height="14" hspace="22" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/clients/sample_tracking.html"><img src="../images/loan_tracking2.gif" width="79" height="14" hspace="16" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/clients/articles/apr.html"><img src="../images/articles_interest2.gif" width="111" height="14" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="agent_login.php"><img src="../images/agent_login2.gif" width="67" height="14" hspace="22" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="108"></td>
  </tr>
  <tr>
    <td colspan="3" align="center"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/our_promise.html">Our Promise</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="../../clients/client_login.php">Client Login</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/clients/sample_tracking.html">Loan Tracking</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/clients/articles/apr.html">Articles of Interest</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="../../agents/agent_login.php">Agent Login</a></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="3" align="center"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><a class="two" href="#">Privacy Policy</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="#">Legal Statement</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="#">Contact Us</a></td>
        </tr>
      </table></td>
  </tr>
</table>
<!-- InstanceBeginEditable name="EditRegion7" --><!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
}
?>
Avatar of dbetts

ASKER

Section Two: applenders_sub.php

<?php
require '../Connections/db_gl_connect.php';
if ($logged_in == 0) {
      die('Sorry you are not logged in, this area is restricted to registered agents. <a href="agent_login.php">Click here</a> to log in.');
$db_object->disconnect();
}
$prefstate = $_COOKIE['prefstate'];

if (isset($_POST['submit'])) { // if data on form is to be saved...
      function numericOnly($string) { //function to strip characters other than numerals from a string    
          $numString = ereg_replace("[^[:digit:]]", "", $string);
          return $numString;
      }

      $listnumber = $_POST['idnumber'];
      //Pull all of the selected states from the post...
      $msgid = 'sentmsg'.$listnumber;
      $msg = $_POST[$msgid];
      $aData = split(";",$msg);
      
      $s = 'DELETE FROM lender_states WHERE lenderid = '.$listnumber.';';
      for ( $i = 0; $i < count($aData); $i++ ) {
            $thisVar = split(":",$aData[$i]);
            $postName = $thisVar[0];
            $postValue = $thisVar[1];
            
            $length = strlen($postValue);
            if ($length > 3) {
                  $value = substr($postValue,0,strlen($postValue)-3);
                  $s .= "INSERT INTO lender_states (lenderid, state) Values (".$listnumber.", '".$value."');";      
            }
      }
      
      $sql = $db_object->query($s);
      if (DB::isError($sql)) {
            die($s." ".$sql->getMessage());
      }
      
      $date = date('m d, Y');
      $table_name = 'lenderinfo';
      
      if ($listnumber == 'abc') {
            $cr=chr(0x0D); //search for all LFCR  and replace with <br />
    $lf=chr(0x0A);
            $programs = str_replace($cr.$lf, "<br />", $_POST['programsL']);
            $fields_values = array(
                  'company' => $_POST['companyL'],
                  'phone' => numericOnly($_POST['phoneL']), //Strip everything but the numbers....
                  'ext' => numericOnly($_POST['extL']),
                  'cellphone' => numericOnly($_POST['cellphoneL']),
                  'fax' => numericOnly($_POST['faxL']),
                  'email' => $_POST['emailL'],
                  'programs' => $programs,
                  'firstname' => $_POST['firstnameL'],  
                  'lastname' => $_POST['lastnameL'],
                  'address' => $_POST['addressL'],
                  'city' => $_POST['cityL'],
                  'state' => $_POST['stateL'],
                  'zip' => $_POST['zipL'],
                  'lenderstation' => $_SESSION['busunit']
                  );
            
            $res = $db_object->autoExecute($table_name, $fields_values, DB_AUTOQUERY_INSERT);                        
            if (DB::isError($res)) {
                  die($res->getMessage());
            }
      }
      else {
            $cr=chr(0x0D); //search for all LFCR  and replace with \n\r
    $lf=chr(0x0A);
            $programs = str_replace($cr.$lf, "<br />",$_POST['programs'.$listnumber]);      

            $fields_values = array(
                  'company' => $_POST['company'.$listnumber],
                  'phone' => numericOnly($_POST['phone'.$listnumber]), //Strip everything but the numbers....
                  'ext' => numericOnly($_POST['ext'.$listnumber]),
                  'cellphone' => numericOnly($_POST['cellphone'.$listnumber]),
                  'fax' => numericOnly($_POST['fax'.$listnumber]),
                  'email' => $_POST['email'.$listnumber],
                  'programs' => $programs,
                  'firstname' => $_POST['firstname'.$listnumber],  
                  'lastname' => $_POST['lastname'.$listnumber],
                  'address' => $_POST['address'.$listnumber],
                  'city' => $_POST['city'.$listnumber],
                  'state' => $_POST['state'.$listnumber],
                  'zip' => $_POST['zip'.$listnumber],
                  'lenderstation' => $_SESSION['busunit']
                  );
            
            $res = $db_object->autoExecute($table_name, $fields_values, DB_AUTOQUERY_UPDATE, 'lenderid = '.$listnumber);                        
            if (DB::isError($res)) {
                  die($res->getMessage());
            }
      }
      $db_object->disconnect();

      echo("<script language='javascript' type='text/javascript'>
                  window.location.href = 'https://secure.EvergreenMortgageInc.com/agents/applenders.php';
                  </script>");

} else {      // if form hasn't been submitted
      if (($prefstate != '') && ($prefstate != '*All*')) {
            $sql = "SELECT * FROM lenderinfo WHERE lenderstation = '".$_SESSION['busunit']."'
                                          AND lenderid in (SELECT lenderid FROM lender_states WHERE state = '".$prefstate."')
                                    ORDER BY status,company";
      } else {
            $sql = "SELECT * FROM lenderinfo WHERE lenderstation = '".$_SESSION['busunit']."' ORDER BY status,company";
      }
      $check = $db_object->query($sql);
      if (DB::isError($check)) {
            echo("<script language='javascript' type='text/javascript'>
                  alert('There was an error opening the Approved Lenders data.\\nPlease login again');
                  window.location.href = 'https://secure.EvergreenMortgageInc.com/agents/agent_login.php';
                  </script>");
            die($check->getMessage());
      }
function formatPhone($phone) {
      if (empty($phone)) return "";
      sscanf($phone, "%3d%3d%4s", $area, $prefix, $exchange);
      $out = @$area ? "($area) " : "";
      $out .= $prefix . '-' . $exchange;
      return $out;
}
function getGlyph($value) {
      $hrd = round(($value*2), 0)/2;
      if ($hrd == 0.5) {
            $glyphname = "0_5.gif";
      }
      elseif ($hrd == 1) {
            $glyphname = "1.gif";
      }
      elseif ($hrd == 1.5) {
            $glyphname = "1_5.gif";
      }
      elseif ($hrd == 2) {
            $glyphname = "2.gif";      
      }
      elseif ($hrd == 2.5) {
            $glyphname = "2_5.gif";      
      }
      elseif ($hrd == 3) {
            $glyphname = "3.gif";      
      }
      elseif ($hrd == 3.5) {
            $glyphname = "3_5.gif";      
      }
      elseif ($hrd == 4) {
            $glyphname = "4.gif";      
      }
      elseif ($hrd == 4.5) {
            $glyphname = "4_5.gif";      
      }
      elseif ($hrd == 5) {
            $glyphname = "5.gif";      
      }
      else {
            $glyphname = "unrated.gif";      
      }
      return $glyphname;
}

?>
<html><!-- InstanceBegin template="/Templates/Secure_Sub_Agents.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Evergreen Mortgage Inc.</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<link href="../css/evergreen.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../scripts/applenders.js" type="text/javascript"></script>
<?php
echo("
<script language='JavaScript'>
      var lendersArray=new Array();\n");
            while ($info = $check->fetchRow()) {                        
            echo("lendersArray[lendersArray.length] = 'ala".$info['lenderid']."';\n");
      }
      echo("
      lendersArray[lendersArray.length] = 'addLender';\n
</script>");
?>
<style type="text/css">
<!--
iframe {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-style: normal;
      border: 1px solid;
      position: relative;
      height: 63px;
      width: 103px;
}
-->
</style>
<!-- InstanceEndEditable -->
<script language="JavaScript" type="text/javascript" src="../scripts/secure_agents.js"></script>
<SCRIPT>
function getTag(el,str) {
      while ((el!=null) && (str.indexOf(el.tagName + ":")<0))
            el = el.parentElement
      return el
}

function navigateTo(sURL,target) {
        if ((target == '_self') || (target=="")) {
            window.location.replace(sURL);
            return false;
      }
      if (target == '_top') {
            top.window.location.replace(sURL);
            return false
      }
      if (target =='_parent') {
            parent.window.location.replace(sURL);
            return false;
      }
      if (target == '_blank' || parent.frames.length < 1) {
            window.open(sURL, target);
                return false;
      }
      else {
            if (parent.frames[target])
                  parent.frames[target].location.replace(sURL);
                else
                  window.open(sURL, target);
                return false;
      }
}

function checkIEClick() {
      var el = getTag(event.srcElement,"A:AREA:")
      if ((el!=null) && ((el.tagName=="A") || (el.tagName=="AREA"))) {
            event.returnValue = false
            navigateTo(el.href,String(el.target).toLowerCase())
      }
}

function checkNSClick(ev) {
      if (ev.target.href) {
            navigateTo(ev.target.href,String(ev.target).toLowerCase())
            return false
      }

}

if ((document.all) || (document.layers))
      if (document.layers) {
            document.captureEvents(Event.CLICK)
            document.onclick = checkNSClick
      }
      else
            document.onclick = checkIEClick
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<!-- InstanceBeginEditable name="Body_Script" --><!-- InstanceEndEditable -->
<table width=800 border=0 cellspacing=0 cellpadding=0>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="2"></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/top_bar.gif" width="800" height="12"></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="2"></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="4"></td>
  </tr>
  <tr>
    <td align="center" valign="middle"><img src="../images/logo.gif" width="174" height="64" hspace="13"></td>
            <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
            <td bgcolor="#909B8E"><!-- InstanceBeginEditable name="Page Header" --><img src="../images/top_shadow.gif" width="594" height="75"><!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td><img src="../images/spacer.gif" width="1" height="2"></td>
            <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
            <td><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr>
    <td><img src="../images/spacer.gif" width="200" height="2"></td>
    <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=1></td>
    <td><img src="../images/spacer.gif" width="596" height="1"></td>
  </tr>
  <tr valign="top">      
    <td background="../images/menu_2_divider.gif">
      <table border="0" cellpadding="0" cellspacing="0" background="../images/menu_background4.gif">
            <tr>
                          <td>
                              <table border="0" cellpadding="0" cellspacing="0">
              <!-- InstanceBeginEditable name="Side Menu" -->
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="176" height="60"></td>
                <td rowspan="11"><img src="../images/spacer.gif" width="24" height="1"></td>
              </tr>
              <!-- InstanceEndEditable -->
              <tr>
                <td colspan="2" align="right"><a href="http://www.EvergreenMortgageInc.com"><img src="../images/home.gif" width="40" height="16" border="0"></a></td>
              </tr>
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="1" height="7"></td>
              </tr>
              <tr>
                <td colspan="2" align="right"><a href="agentsmain.php"><img src="../images/agents_main.gif" width="91" height="16" border="0"></a></td>
              </tr>
              <tr>
                <td colspan="2"><img src="../images/spacer.gif" width="1" height="8"></td>
              </tr>
              <tr><td>
                                          <div align="right" id=Outline name=Outline>
                                          <img src="../images/welcome.gif" alt="Welcome" width="48" height="17" id=Out1a style="cursor: hand" class="Outline"><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out1 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out1d style="display:None">
                                                      <A href='welcome.html'><img src="../images/welcome_sub.gif" alt="Welcome Agents" width="40" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                      <A href='successful_agent.html'><img src="../images/welcome_successful.gif" alt="How to be a successful Agent" width="135" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                      <A href='manage_loans.html'><img src="../images/welcome_manage.gif" alt="How to manage your loans" width="125" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>                                          
                                          <img src="../images/prospect_list.gif" alt="Prospect List" width="68" height="17" id=Out2a style="cursor: hand" class="Outline"><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out2 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out2d style="display:None">
                                                      <A href='prospect_list.php'><img src="../images/prospect_list_sub.gif" alt="Prospect List" width="57" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                  <A href='phone_script.html' target="_blank"><img src="../images/prospect_script.gif" alt="Phone Script" width="56" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>
                                          <img src="../images/matrix.gif" alt="Open a Matrix" width="76" height="17" id=Out3a style="cursor: hand" class="Outline" border=0><img src='../images/closed_arrow.gif' width="8" height="8" vspace="3" id=Out3 style="cursor: hand" class="Outline"><br>
                                                <div align="right" id=Out3d style="display:None">
                                                      <A href='open_matrix.php'><img src="../images/open_matrix_sub.gif" alt="Open a Matrix" width="63" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                  <A href='print_matrix.html' target="_blank"><img src="../images/print_matrix.gif" alt="Print a Blank Matrix" width="88" height="14" border=0><IMG src="../images/spacer.gif" height=1 width=20 border=0></A><br>
                                                </div>
                                          <A href="lender_replies.php"><img src="../images/lender_replies.gif" alt="Lender Replies" width="78" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="applenders.php"><img src="../images/applenders.gif" alt="Approved Lenders" width="96" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="forum/"><img src="../images/forum.gif" alt="Agent's Forum" width="77" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="download.php"><img src="../images/downloads.gif" alt="Agent's Forum" width="60" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="lifeplan.html"><img src="../images/lifeplan.gif" alt="Agent's Forum" width="47" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                          <A href="logout.php"><img src="../images/logout.gif" alt="Agent's Forum" width="40" height="17" border=0><img src='../images/spacer.gif' width="8" height="8" border=0></A><br>
                                    </div></td>
                                    </tr>
                              </table>
                        </td>
                  </tr>
            </table>
            <script language="JavaScript">Outline.onclick=doOutline</script>
            </td>    
    <td background="../images/menu_vert_divider.gif"><img src="../images/spacer.gif" width=4 height=250></td>
            <td valign="top" background="../images/bkGrnd.gif">
            <table border="0" cellspacing="0" cellpadding="0">
                  <tr bgcolor="#FFFFFF">
                        <td colspan="5"><img src="../images/spacer.gif" width="1" height="20"></td>
                  </tr>
                  <tr>
                        <td><img src="../images/spacer.gif" width="20" height="6"></td>
                        <td><img src="../images/spacer.gif" width="7" height="1"></td>
                        <td><img src="../images/spacer.gif" width="4" height="1"></td>
                        <td><img src="../images/spacer.gif" width="545" height="1"></td>
                        <td><img src="../images/spacer.gif" width="20" height="1"></td>
                  </tr>
                  <tr>
                        <td><img src="../images/spacer.gif" width="20" height="1"></td>
                          <td colspan="3"><!-- InstanceBeginEditable name="Page SubHeader" --><img src="../images/approved_lenders_header.gif" width="267" height="21"><!-- InstanceEndEditable --></td>
                        <td rowspan="4"><img src="../images/spacer.gif" width="20" height="1"></td>
                  </tr>
                  <tr>
                        <td rowspan="3"><img src="../images/spacer.gif" width="20" height="1"></td>
                        <td valign="top"><img src="../images/page_linerV.gif" width="7" height="102"></td>          
                        <td><img src="../images/spacer.gif" width="10" height="1"></td>
                        <!-- InstanceBeginEditable name="Main Text" -->
                        <td valign="top">
                              <?php include('applenders_sub.php'); ?>
                        </td>
                        <!-- InstanceEndEditable --></tr>
            </table></td>
      </tr>
  <tr>
            <td background="../images/menu_2_divider.gif"><img src="../images/spacer.gif" width="1" height="4"></td>
            <td colspan="2"><img src="../images/spacer.gif" width=1 height=1></td>
  </tr>
      <tr>
    <td colspan="3" bgcolor="#B5BABB"><img src="../images/spacer.gif" width="1" height="1"></td>
  </tr>
      <tr>
    <td background="../images/menu_2_divider.gif"><img src="../images/spacer.gif" width="1" height="68"></td>
            <td colspan="2"><img src="../images/spacer.gif" width=1 height=1></td>
  </tr>
      <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="4"></td>
  </tr>
  <tr>
    <td colspan="3" align="center" background="../images/bottom_bar.gif"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/our_promise.html"><img src="../images/our_promise2.gif" width="69" height="14" hspace="21" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="../clients/client_login.php"><img src="../images/client_login2.gif" width="68" height="14" hspace="22" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/clients/sample_tracking.html"><img src="../images/loan_tracking2.gif" width="79" height="14" hspace="16" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="http://www.EvergreenMortgageInc.com/clients/articles/apr.html"><img src="../images/articles_interest2.gif" width="111" height="14" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
          <td><a href="agent_login.php"><img src="../images/agent_login2.gif" width="67" height="14" hspace="22" border="0"></a></td>
          <td valign="top"><img src="../images/menu_middle_line.gif" width="1" height="34" hspace="3"></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="3"><img src="../images/spacer.gif" width="1" height="108"></td>
  </tr>
  <tr>
    <td colspan="3" align="center"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/our_promise.html">Our Promise</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="../../clients/client_login.php">Client Login</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/clients/sample_tracking.html">Loan Tracking</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="http://www.EvergreenMortgageInc.com/clients/articles/apr.html">Articles of Interest</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="../../agents/agent_login.php">Agent Login</a></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td colspan="3" align="center"> <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><a class="two" href="#">Privacy Policy</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="#">Legal Statement</a></td>
          <td><img src="../images/menu_bottom_line.gif" width="1" height="15" hspace="3"></td>
          <td><a class="two" href="#">Contact Us</a></td>
        </tr>
      </table></td>
  </tr>
</table>
<!-- InstanceBeginEditable name="EditRegion7" --><!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
}
?>
Avatar of dbetts

ASKER

Section Two: applenders_sub.php  (the listing above was a copy on the main page [section one], sorry).

<?php
echo('                              
<table border=0 cellspacing=0 cellpadding=0>
<form name=lendersform action="'.$_SERVER['PHP_SELF'].'" method=post>
      <tr><!-- Column spacing -->
            <td><img src="../images/spacer.gif" width=30 height=1></td>
      <td><img src="../images/spacer.gif" width=150 height=1></td>
      <td><img src="../images/spacer.gif" width=301 height=1></td>
      <td><img src="../images/spacer.gif" width=86 height=1></td>
      </tr>
      <tr>
            <td colspan=2><img src="../images/spacer.gif" width=1 height=1></td>
            <td align=right><span class=five>Lender Region:</span></td>
            <td><select name=prefstate onChange=SetCookie(\'prefstate\')><option value='.$prefstate.' selected>'.$prefstate.'</option><option value=*All*>*All*</option><option value=AL>AL</option><option value=AK>AK</option><option value=AZ>AZ</option><option value=AR>AR</option><option value=CA>CA</option><option value=CO>CO</option><option value=CT>CT</option><option value=DE>DE</option><option value=DC>DC</option><option value=FL>FL</option><option value=GA>GA</option><option value=HI>HI</option><option value=ID>ID</option><option value=IL>IL</option><option value=IN>IN</option><option value=IA>IA</option><option value=KS>KS</option><option value=KY>KY</option><option value=LA>LA</option><option value=ME>ME</option><option value=MD>MD</option>
                              <option value=MA>MA</option><option value=MI>MI</option><option value=MN>MN</option><option value=MS>MS</option><option value=MO>MO</option><option value=MT>MT</option><option value=NE>NE</option><option value=NV>NV</option><option value=NH>NH</option><option value=NJ>NJ</option><option value=NM>NM</option><option value=NY>NY</option><option value=NC>NC</option><option value=ND>ND</option><option value=OH>OH</option><option value=OK>OK</option><option value=OR>OR</option><option value=PA>PA</option><option value=RI>RI</option><option value=SC>SC</option><option value=SD>SD</option><option value=TN>TN</option><option value=TX>TX</option><option value=UT>UT</option><option value=VT>VT</option><option value=VA>VA</option><option value=WA>WA</option><option value=WV>WV</option>
                              <option value=WI>WI</option><option value=WY>WY</option></select></td>
      </tr>
      <tr><!-- Header -->
            <td><span class=five>&nbsp;</span></td>
            <td><span class=five>Lender</span></td>
            <td><span class=five>Best Programs</span></td>
            <td align=center><span class=five>Rating</span></td>                        
      </tr>
      <tr>
            <td colspan=5><img src="../images/dot_blue.gif" width=567 height=1></td>
      </tr>
');       
                                                      
$counter = 0;
while ($info = $check->fetchRow(DB_FETCHMODE_ASSOC, $counter)) {
      $counter++;
      echo('<tr>
                              <td align=center valign=top><img src="../images/spacer.gif" width=1 height=7><br />
                                    <input style="background-image:url(../images/pencil.gif); width:21px;height:20;border:0px;cursor=pointer;cursor:hand;" name=edit'.$info['lenderid'].' type=button value="" onClick="openEdits(lendersArray,\''.$info['lenderid'].'\',\'ala'.$info['lenderid'].'\');">
      ');
      if (($_SESSION['agenttype'] == 'admin') || ($_SESSION['agenttype'] == 'srmanager')) {
            echo('<br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <input style="background-image:url(../images/delete.gif); width:21px; height:20; border:0px;cursor=pointer;cursor:hand;" name=delete'.$info['lenderid'].' type=button value="" onClick="deleteLender(\''.$info['lenderid'].'\',\''.$info['company'].'\');">
            ');
      }
      echo('<br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <a href="mailto:'.$info['email'].'" target=_blank><img src="../images/email.gif" width=21 height=20 border=0;></a>
      ');
      if ($info['status'] == 'a') {
            echo('</td>
                              <td valign=top id='.$info['lenderid'].'><span class=four><b>'.$info['company'].'</b><br />'.$info['firstname'].' '.$info['lastname'].'<br />
            ');
      } else {
            echo('</td>
                              <td valign=top id='.$info['lenderid'].'><span class="four-"><b>'.$info['company'].'</b><br />'.$info['firstname'].' '.$info['lastname'].'<br />
            ');
      }
      if ($info['ext'] <> '') {
            echo('Phone: '.formatPhone($info['phone']).' x: '.$info['ext'].' <br />
            ');
      }
      else {
            echo('Phone: '.formatPhone($info['phone']).'<br />
            ');
      }
      echo('Fax: '.formatPhone($info['fax']).'<br />
                        Mobile: '.formatPhone($info['cellphone']).'</span></td>
            <td rowspan=2 valign=top><span class=four>'.stripslashes($info['programs']).'</span></td>
            <td valign=top align=center><img src="../images/spacer.gif" width=1 height=10><br /><img src="../images/'.getGlyph($info['rating']).'" width=80 height=13><br />
                  <br /><input style="background-image:url(../images/opinions.gif); width:106px; height:25;border:0px;cursor=pointer;cursor:hand;" name=rcard type=button value="" onClick="openRC(\''.$info['lenderid'].'\',\''.$info['company'].'\',\''.$info['firstname'].' '.$info['lastname'].'\',\''.getGlyph($info['rating']).'\');"></td>
      </tr>
      <tr>
            <td><img src="../images/spacer.gif" width=1 height=1></td>
            <td><img src="../images/spacer.gif" width=1 height=1></td>
            <td><img src="../images/spacer.gif" width=1 height=1></td>
      </tr>
      <tr>
            <td colspan=4><img src="../images/dot_blue.gif" width=567 height=1></td>
      </tr>
      ');      
}        
echo('
      <tr>
            <td colspan=4><img src="../images/spacer.gif" width=1 height=12></td>
      </tr>
      <tr>
            <td colspan=4 align=center><input id=addButton style="background-image:url(../images/addlender.gif); width:143px; height:25;border:0px;cursor=pointer;cursor:hand;" name=newlender type=button value="" onClick="addLender(lendersArray,\'addLender\')"></td>
      </tr>
      <tr>
            <td colspan=4><img src="../images/spacer.gif" width=1 height=12></td>
      </tr>
</form>
</table>
');      
                        
include('applenders_sub_sub.php');

echo("
<div id='addLender' style='visibility:hidden;position:absolute;left:193px;top:193px;border:2px solid black;'>
      <table width='567' border='0' cellspacing='0' cellpadding='0'  background='../images/bkGrnd.gif'>
      <form name='formLender' action='".$_SERVER['PHP_SELF']."' method='post'>
            <tr>
                  <td><img src='../images/spacer.gif' width=110 height=1></td>
                  <td><img src='../images/spacer.gif' width=457 height=1></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>Company Name</span></td>
                  <td><span class='four'><input name='companyL' type='text' size='30' maxlength='120' value=''><input name='idnumber' value='abc' type='hidden'></span></td></tr>
            <tr>
                  <td align='right'><span class='four'>Address</span></td>
                  <td><span class='four'><input name='addressL' type='text' size='40' maxlength='120' value=''></span></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>City</span></td>
                  <td><span class='four'><input name='cityL' type='text' size='20' maxlength='40' value=''>&nbsp;State&nbsp;
                        <select name='state16'><option value='' selected></option><option value='AL'>AL</option><option value='AK'>AK</option><option value='AZ'>AZ</option><option value='AR'>AR</option><option value='CA'>CA</option><option value='CO'>CO</option><option value='CT'>CT</option><option value='DE'>DE</option><option value='DC'>DC</option><option value='FL'>FL</option><option value='GA'>GA</option><option value='HI'>HI</option><option value='ID'>ID</option><option value='IL'>IL</option><option value='IN'>IN</option><option value='IA'>IA</option><option value='KS'>KS</option><option value='KY'>KY</option><option value='LA'>LA</option><option value='ME'>ME</option><option value='MD'>MD</option>
                              <option value='MA'>MA</option><option value='MI'>MI</option><option value='MN'>MN</option><option value='MS'>MS</option><option value='MO'>MO</option><option value='MT'>MT</option><option value='NE'>NE</option><option value='NV'>NV</option><option value='NH'>NH</option><option value='NJ'>NJ</option><option value='NM'>NM</option><option value='NY'>NY</option><option value='NC'>NC</option><option value='ND'>ND</option><option value='OH'>OH</option><option value='OK'>OK</option><option value='OR'>OR</option><option value='PA'>PA</option><option value='RI'>RI</option><option value='SC'>SC</option><option value='SD'>SD</option><option value='TN'>TN</option><option value='TX'>TX</option><option value='UT'>UT</option><option value='VT'>VT</option><option value='VA'>VA</option><option value='WA'>WA</option><option value='WV'>WV</option>
                              <option value='WI'>WI</option><option value='WY'>WY</option></select>
                              &nbsp;Zip&nbsp;<input name='zipL' type='text' size='6' maxlength='10' value=''></span></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>First Name</span></td>
                  <td><span class='four'><input name='firstnameL' type='text' size='16' maxlength='20' value=''>&nbsp;Last Name&nbsp;<input name='lastnameL' type='text' size='16' maxlength='20' value=''></span></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>Phone</span></td>
                  <td><span class='four'><input name='phoneL' type='text' size='14' maxlength='14' value=''>&nbsp;Ext&nbsp;<input name='extL' type='text' size='6' maxlength='6' value=''>&nbsp;Fax&nbsp;<input name='faxL' type='text' size='14' maxlength='14' value=''>&nbsp;Mobile&nbsp;<input name='cellphoneL' type='text' size='14' maxlength='14' value=''></span></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>Email</span></td>
                  <td><span class='four'><input name='emailL' type='text' size='60' maxlength='120' value=''></span></td>
            </tr>
            <tr>
                  <td align='right'><span class='four'>Best Programs</span></td>
                  <td><span class='four'><textarea class='one_b' name='programsL'></textarea></span></td>
            </tr>
            <tr>
                  <td>&nbsp;</td>
                  <td><input style=\"background-image:url(../images/save.gif); width:106px; height:25;border:0px; cursor: hand;\" name='submit' type='submit' value=''>&nbsp;&nbsp;&nbsp;
                        <input style=\"background-image:url(../images/cancel.gif); width:106px; height:25;border:0px; cursor: hand;\" name=cancel type=button value='' onClick=\"openEdits(lendersArray,'addButton','addLender');\">
            </td>
            <tr>
                  <td colspan=2><img src='../images/spacer.gif' width=1 height=12></td>
            </tr>
      </form>
      </table>
</div>
");
        
?>

Avatar of dbetts

ASKER

Section Three:  applenders_sub_sub.php (This is the page I can comment out and ALL the buttons work as expected)

<?php
$counter = 0;
$cr=chr(0x0D); //search for all <br /> and replace with LFCR
$lf=chr(0x0A);
while ($info = $check->fetchRow(DB_FETCHMODE_ASSOC, $counter)) {
      $counter++;
      $programs = str_replace("<br />",$cr.$lf,$info['programs']);                        
      echo('
            <div id=ala'.$info['lenderid'].' style="visibility:hidden;position:absolute;left:193px;top:193px;border:2px solid black;">
                  <table width=567 border=0 cellspacing=0 cellpadding=0 background="../images/bkGrnd.gif">
                  <form name="form'.$info['lenderid'].'" action="'.$_SERVER['PHP_SELF'].'" method="post" onSubmit="return SubmitMe('.$info['lenderid'].');">
                        <tr>
                              <td><img src="../images/spacer.gif" width=110 height=1></td>
                              <td><img src="../images/spacer.gif" width=348 height=1></td>
                              <td><img src="../images/spacer.gif" width=102 height=1></td>
                        </tr><input type=hidden id="sentmsg'.$info['lenderid'].'" name="sentmsg'.$info['lenderid'].'" value="">
                        <tr>
                              <td align="right"><span class="four">Company Name</span></td>
                              <td><span class="four"><input name="company'.$info['lenderid'].'" type="text" size="47" maxlength="120" value="'.$info['company'].'"></span><input name="idnumber" value="'.$info['lenderid'].'" type="hidden"></td>
                              <td rowspan=4 valign=top>
                              
                              <span class="four">Licensed States</span><iframe id="ifm'.$info['lenderid'].'" name="ifm'.$info['lenderid'].'" src="../images/spacer.gif"></iframe>
                              
                              </td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">Address</span></td>
                              <td><span class="four"><input name="address'.$info['lenderid'].'" type="text" size="47" maxlength="120" value="'.$info['address'].'"></span></td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">City</span></td>
                              <td><span class="four"><input name="city'.$info['lenderid'].'" type="text" size="20" maxlength="40" value="'.$info['city'].'">&nbsp;State&nbsp;
                                    <select name="state'.$info['lenderid'].'"><option value="'.$info['state'].'" selected>'.$info['state'].'</option><option value="AL">AL</option><option value="AK">AK</option><option value="AZ">AZ</option><option value="AR">AR</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DE">DE</option><option value="DC">DC</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="IA">IA</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="ME">ME</option><option value="MD">MD</option>
                                          <option value="MA">MA</option><option value="MI">MI</option><option value="MN">MN</option><option value="MS">MS</option><option value="MO">MO</option><option value="MT">MT</option><option value="NE">NE</option><option value="NV">NV</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NY">NY</option><option value="NC">NC</option><option value="ND">ND</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VT">VT</option><option value="VA">VA</option><option value="WA">WA</option><option value="WV">WV</option>
                                          <option value="WI">WI</option><option value="WY">WY</option></select>
                                                &nbsp;Zip&nbsp;<input name="zip'.$info['lenderid'].'" type="text" size="6" maxlength="10" value="'.$info['zip'].'"></span></td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">First Name</span></td>
                              <td><span class="four"><input name="firstname'.$info['lenderid'].'" type="text" size="16" maxlength="20" value="'.$info['firstname'].'">&nbsp;Last Name&nbsp;<input name="lastname'.$info['lenderid'].'" type="text" size="16" maxlength="20" value="'.$info['lastname'].'"></span></td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">Phone</span></td>
                              <td colspan=2><span class="four"><input name="phone'.$info['lenderid'].'" type="text" size="14" maxlength="14" value="'.formatPhone($info['phone']).'">&nbsp;Ext&nbsp;<input name="ext'.$info['lenderid'].'" type="text" size="6" maxlength="6" value="'.$info['ext'].'">&nbsp;Fax&nbsp;<input name="fax'.$info['lenderid'].'" type="text" size="14" maxlength="14" value="'.formatPhone($info['fax']).'">&nbsp;Mobile&nbsp;<input name="cellphone'.$info['lenderid'].'" type="text" size="14" maxlength="14" value="'.formatPhone($info['cellphone']).'"></span></td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">Email</span></td>
                              <td colspan=2><span class="four"><input name="email'.$info['lenderid'].'" type="text" size="60" maxlength="120" value="'.$info['email'].'"></span></td>
                        </tr>
                        <tr>
                              <td align="right"><span class="four">Best Programs</span></td>
                              <td colspan=2><span class="four"><textarea class="one_b" name="programs'.$info['lenderid'].'">'.stripslashes($programs).'</textarea></span></td>
                        </tr>
                        <tr>
                              <td>&nbsp;</td>
                              <td colspan=2><input style="background-image:url(../images/save.gif); width:106px; height:25;border:0px; cursor: hand;" name=submit type=submit value="">&nbsp;&nbsp;&nbsp;
                                    <input style="background-image:url(../images/cancel.gif); width:106px; height:25;border:0px; cursor: hand;" name=cancel type=button value="" onClick="openEdits(lendersArray,\''.$info['lenderid'].'\',\'ala'.$info['lenderid'].'\');"></td>
                        </tr>
                        <tr>
                              <td colspan=3><img src="../images/spacer.gif" width=1 height=12></td>
                        </tr>
                  </form>
                  </table>
            </div>
      ');
}                        

?>
Avatar of dbetts

ASKER

You will notice in the above code that all the buttons are created in a while loop.  Therefore if one group of buttons works, they all should work.  But they don't.  The top three groups of buttons don't work in the IE browser.

Thanks for helping out,
Derrick
Again, can you paste from the resulting page, one of the <input type='button'> which works, and one which doesn't. Also, the openEdits function from scripts/applenders.js or scripts/secure_agents.js, I don't know which.

Can you also change the while loop to change the onclick to start with
onclick="alert('onclick called');openEdits(...
and tell me how that affects the program

Nearly narrowed this down,
_Blue
Avatar of dbetts

ASKER

Buttons don't work:

<tr>
                              <td align=center valign=top><img src="../images/spacer.gif" width=1 height=7><br />
                                    <input style="background-image:url(../images/pencil.gif); width:21px;height:20;border:0px;cursor=pointer;cursor:hand;" name=edit67 type=button value="" onClick="openEdits(lendersArray,'67','ala67');">
      <br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <input style="background-image:url(../images/delete.gif); width:21px; height:20; border:0px;cursor=pointer;cursor:hand;" name=delete67 type=button value="" onClick="deleteLender('67','Alliance Mortgage Company');">
            <br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <a href="mailto:" target=_blank><img src="../images/email.gif" width=21 height=20 border=0;></a>
      </td>
                              <td valign=top id=67><span class=four><b>Alliance Mortgage Company</b><br /> <br />
            Phone: <br />
            Fax: <br />
                        Mobile: </span></td>
            <td rowspan=2 valign=top><span class=four>no #</span></td>
            <td valign=top align=center><img src="../images/spacer.gif" width=1 height=10><br /><img src="../images/unrated.gif" width=80 height=13><br />
                  <br /><input style="background-image:url(../images/opinions.gif); width:106px; height:25;border:0px;cursor=pointer;cursor:hand;" name=rcard type=button value="" onClick="openRC('67','Alliance Mortgage Company',' ','unrated.gif');"></td>
      </tr>

Buttons DO work:

<tr>
                              <td align=center valign=top><img src="../images/spacer.gif" width=1 height=7><br />
                                    <input style="background-image:url(../images/pencil.gif); width:21px;height:20;border:0px;cursor=pointer;cursor:hand;" name=edit16 type=button value="" onClick="openEdits(lendersArray,'16','ala16');">
      <br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <input style="background-image:url(../images/delete.gif); width:21px; height:20; border:0px;cursor=pointer;cursor:hand;" name=delete16 type=button value="" onClick="deleteLender('16','American Mortgage Network');">
            <br /><img src="../images/spacer.gif" width=1 height=7><br />
                              <a href="mailto:bpacky@amnetmortgage.com" target=_blank><img src="../images/email.gif" width=21 height=20 border=0;></a>
      </td>
                              <td valign=top id=16><span class=four><b>American Mortgage Network</b><br />Beverly Packie<br />
            Phone: (925) 691-5393<br />
            Fax: (925) 691-5394<br />
                        Mobile: (510) 409-9787</span></td>
            <td rowspan=2 valign=top><span class=four>100% to $2 Million with 620 FICO full doc or $650k stated with 660 FICO. Also, non-owner interest only.</span></td>
            <td valign=top align=center><img src="../images/spacer.gif" width=1 height=10><br /><img src="../images/unrated.gif" width=80 height=13><br />
                  <br /><input style="background-image:url(../images/opinions.gif); width:106px; height:25;border:0px;cursor=pointer;cursor:hand;" name=rcard type=button value="" onClick="openRC('16','American Mortgage Network','Beverly Packie','unrated.gif');"></td>
      </tr>
Avatar of dbetts

ASKER

This is the openEdits javascript function:

function openEdits(idArray,cell,div_id) {
  //Load the iframe with the proper source...
      theFrame = getElem('ifm'+cell);
      theFrame.src = "states.php?lenderid="+cell;
      //Change visibility...
      var style_sheet = getStyleObject(div_id);
  if (style_sheet) {
    var state = style_sheet.visibility;
      if (state == "hidden") {
        hideAllArray(idArray);
        changeObjectVisibility(div_id,"visible");
      }
      else {
      changeObjectVisibility(div_id,"hidden");
      }
      moveBox(cell,div_id);
  }
  else
  {
    alert("sorry, this only works in browsers that support Dynamic HTML");
  }
}

function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
      return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
      return document.all(objectId).style;
   }
   else if (document.layers && document.layers[objectId]) {
      return document.layers[objectId];
   } else {
      return false;
   }
}

function getElem(div) {      
      if(document.getElementById && document.getElementById(div)) {
            return document.getElementById(div);
  } else if (document.all && document.all(div)) {
            return document.all(div);
  } else if (document.layers && document.layers[div]) {
            return document.layers[div];
  } else {
            return false;
  }
}
Avatar of dbetts

ASKER

You asked:

Can you also change the while loop to change the onclick to start with
onclick="alert('onclick called');openEdits(...
and tell me how that affects the program


The alert is never fired in IE.

Thanks again,
Derrick
ASKER CERTIFIED SOLUTION
Avatar of eeBlueShadow
eeBlueShadow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dbetts

ASKER

Excellent!  Points for you and a lollypop too.

Those darn IE bugs.  (Although it probably isn't a bug, just a matter of me not fully understanding all the programing options with CSS).

Thanks for your help.

Derrick
Yeah, in this case I would think IE had the right behaviour (or at least the common sense behavious). But then, I don't know the W3C specs off by heart.