URGENT! error in code requires fixing!

Overview:

PHP page reads info form access db,

error somewhere within the php code at the date/time comparsing...

<?php

error_reporting(E_ALL); // Activate ALL errors/warnings/notices.

print_r($_POST); // Show the POST array in all its glory.

$rConn = odbc_connect("ConnLink","","");

// Check the results
$sResponse = '';

foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
      if (isset($_POST[$sColumnName])) {
            $sSQL = "UPDATE tblDataDocsReview SET $sColumnName = {$_POST[$sColumnName]} WHERE ID_no={$_POST['ID_no']};";
            // echo $sSQL; // Lets see what the query REALLY says.
            $rResult = odbc_exec($rConn, $sSQL) or die('Problem with the query.');
            // You may want to build a $sResponse to be put at the bottom of the page.
      }
}

// Get new results.
$rResult = odbc_exec ($rConn,"SELECT * FROM tblDataDocsReview");

$sOutput = <<< END_HTML
<html>
<head>
<meta http-equiv="refresh" content="50,defaults.php">
<style type="text/css">
      .global {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;}
      .tbl,td {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;border-bottom-style: solid;border-bottom-color: black;border-bottom-width: 1px;border-left-style: solid;border-left-color: black;border-left-width: 1px;border-top-style: solid;border-top-color: black;border-top-width: 1px;border-right-style: solid;border-right-color: black;border-right-width: 1px;cellpadding:0;cellspacing:0;}
      a{font-family:Trebuchet MS;font-size:12px;}
      a:visited{font-family:Trebuchet MS;font-size:12px;}
      a:hover{font-family:Trebuchet MS;font-size:12px;font-weight:bold;}
      a:active{font-family:Trebuchet MS;font-size:12px;}
</style>
<script language="JavaScript">
<!--
bAllowSubmit = true;

function SubmitForm(obj, uid) {
      if (bAllowSubmit == true) {
            bAllowSubmit = false; // Stop multiple clicks.
            document.HiddenForm.HiddenField.name = obj.name;
            if (obj.checked == true) {
                  document.HiddenForm.HiddenField.value = 1;
            } else {
                  document.HiddenForm.HiddenField.value = 0;
            }
            document.HiddenForm.UniqueID.value = uid;
            document.HiddenForm.submit();
      }
}


status = "BP - Project Endeavour - Tie-in Spool Execute Phrase";

var message = "Sorry! Right Click Disabled";

function clickIE4() {
      if (event.button == 2) {
            alert(message);
            return false;
      }
}

function clickNS4(e) {
      if (document.layers || document.getElementById && !document.all) {
            if (e.which == 2 || e.which == 3) {
                  alert(message);
                  return false;
            }
      }
}

if (document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = clickNS4;
} else if (document.all && !document.getElementById) {
      document.onmousedown = clickIE4;
}
document.oncontextmenu = new Function("alert(message);return false")


//-->
</script>
</head>
<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="24" bgcolor="white">
<form name="HiddenForm" method="POST" action="{$_SERVER['PHP_SELF']}">
     <input type="hidden" id="HiddenField" name="" value="">
     <input type="hidden" id="UniqueID" name="ID_no" value="">
</form>
<p class="global">Documents to be reviewed are as follows:</p>
<table width="97.5%" class="tbl">
<tr>
      <th width="10%" height="2%" valign="top" align="center">Entry Date</th>
      <th width="14%" height="2%" valign="top" align="center">Actionee</th>
      <th width="26%" height="2%" valign="top" align="center">Document to be Reviewed</th>
      <th width="20%" height="2%" valign="top" align="center">Comment Sheet</th>
      <th width="20%" height="2%" valign="top" align="center">Deadline Date/Time</th>
      <th width="8%" height="2%" valign="top" align="center">Comments Submitted</th>
      <th width="8%" height="2%" valign="top" align="center">Responses Submitted</th>
    <th width="8%" height="2%" valign="top" align="center">Comments Approved</th>
</tr>


END_HTML;

while (($aRow = odbc_fetch_array($rResult)) !== False) {

     $startdate = date('m/d/Y');
       $eventdate = $aRow['Months']."/".$aRow['Dates']."/".$aRow['Years'];

     foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
          $$sColumnName = ($aRow[$sColumnName] === '1')?' CHECKED':'';
     }
     $sOutput .= <<< END_HTML

<tr>
      <td width="10%" height="5%" valign="top" align="center">{$aRow['Date']}</td>
      <td width="14%" height="5%" valign="top" align="center">{$aRow['User']}</td>
      <td width="26%" height="5%" valign="top" align="center"><a href="{$aRow['FilePath']}" target="_blank">{$aRow['FilePathName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center"><a href="{$aRow['CommentSheet']}" target="_blank">{$aRow['CommentName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center">{$aRow['Dates']}/{$aRow['Months']}/{$aRow['Years']} @ {$aRow['Hours']}:{$aRow['Minutes']}:{$aRow['Seconds']}<br/>

<?php
if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1){
?>
      <span style="color:red;"><b>This Document is overdue</b></span>
<?php
}
elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1)
{
?>
      <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>
<?php
}
else
{
      <span style="color:black;"><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</span>
<?php
}
?>
</td>
</tr>

END_HTML;
}

$sOutput .= <<< END_HTML
</table>
$sResponse
</body>
</html>
END_HTML;

echo $sOutput;
?>

no errors reporting but its shown "days remaining" and "document overdue" both at same time, plus checkbox arent shown either...


cheers

sean
LVL 16
ellandrdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
You can not use <?php -tags insed the HERE-DOCs. They are added to the HTMl-source and not executed.

$sOutput .= <<< END_HTML

END_HTML

So you should do it this way:
    $sOutput .= <<< END_HTML

<tr>
     <td width="10%" height="5%" valign="top" align="center">{$aRow['Date']}</td>
     <td width="14%" height="5%" valign="top" align="center">{$aRow['User']}</td>
     <td width="26%" height="5%" valign="top" align="center"><a href="{$aRow['FilePath']}" target="_blank">{$aRow['FilePathName']}</a></td>
     <td width="20%" height="5%" valign="top" align="center"><a href="{$aRow['CommentSheet']}" target="_blank">{$aRow['CommentName']}</a></td>
     <td width="20%" height="5%" valign="top" align="center">{$aRow['Dates']}/{$aRow['Months']}/{$aRow['Years']} @ {$aRow['Hours']}:{$aRow['Minutes']}:{$aRow['Seconds']}<br/>
END_HTML;

if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1){
$sOutput .= <<< END_HTML
     <span style="color:red;"><b>This Document is overdue</b></span>
END_HTML;

}
elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1)
{
$sOutput .= <<< END_HTML
     <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>
END_HTML;

}
else
{
$sOutput .= <<< END_HTML
     <span style="color:black;"><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</span>
END_HTML;

}

 ..
0
ellandrdAuthor Commented:
can you possible add what youve done into this updated code:

<?php
error_reporting(E_ALL); // Activate ALL errors/warnings/notices.

print_r($_POST); // Show the POST array in all its glory.

$rConn = odbc_connect("ConnLink","","");

// Check the results
$sResponse = '';

foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
      if (isset($_POST[$sColumnName])) {
            $sSQL = "UPDATE tblDataDocsReview SET $sColumnName = {$_POST[$sColumnName]} WHERE ID_no={$_POST['ID_no']};";
            // echo $sSQL; // Lets see what the query REALLY says.
            $rResult = odbc_exec($rConn, $sSQL) or die('Problem with the query.');
            // You may want to build a $sResponse to be put at the bottom of the page.
      }
}

// Get new results.
$rResult = odbc_exec ($rConn,"SELECT * FROM tblDataDocsReview");

$sOutput = <<< END_HTML
<html>
<head>
<meta http-equiv="refresh" content="50,defaults.php">
<style type="text/css">
      .global {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;}
      .tbl,td {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;border-bottom-style: solid;border-bottom-color: black;border-bottom-width: 1px;border-left-style: solid;border-left-color: black;border-left-width: 1px;border-top-style: solid;border-top-color: black;border-top-width: 1px;border-right-style: solid;border-right-color: black;border-right-width: 1px;cellpadding:0;cellspacing:0;}
      a{font-family:Trebuchet MS;font-size:12px;}
      a:visited{font-family:Trebuchet MS;font-size:12px;}
      a:hover{font-family:Trebuchet MS;font-size:12px;font-weight:bold;}
      a:active{font-family:Trebuchet MS;font-size:12px;}
</style>
<script language="JavaScript">
<!--
bAllowSubmit = true;

function SubmitForm(obj, uid) {
      if (bAllowSubmit == true) {
            bAllowSubmit = false; // Stop multiple clicks.
            document.HiddenForm.HiddenField.name = obj.name;
            if (obj.checked == true) {
                  document.HiddenForm.HiddenField.value = 1;
            } else {
                  document.HiddenForm.HiddenField.value = 0;
            }
            document.HiddenForm.UniqueID.value = uid;
            document.HiddenForm.submit();
      }
}


status = "BP - Project Endeavour - Tie-in Spool Execute Phrase";

var message = "Sorry! Right Click Disabled";

function clickIE4() {
      if (event.button == 2) {
            alert(message);
            return false;
      }
}

function clickNS4(e) {
      if (document.layers || document.getElementById && !document.all) {
            if (e.which == 2 || e.which == 3) {
                  alert(message);
                  return false;
            }
      }
}

if (document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = clickNS4;
} else if (document.all && !document.getElementById) {
      document.onmousedown = clickIE4;
}
document.oncontextmenu = new Function("alert(message);return false")


//-->
</script>
</head>
<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="24" bgcolor="white">
<form name="HiddenForm" method="POST" action="{$_SERVER['PHP_SELF']}">
     <input type="hidden" id="HiddenField" name="" value="">
     <input type="hidden" id="UniqueID" name="ID_no" value="">
</form>
<p class="global">Documents to be reviewed are as follows:</p>
<table width="97.5%" class="tbl">
<tr>
      <th width="10%" height="2%" valign="top" align="center">Entry Date</th>
      <th width="14%" height="2%" valign="top" align="center">Actionee</th>
      <th width="26%" height="2%" valign="top" align="center">Document to be Reviewed</th>
      <th width="20%" height="2%" valign="top" align="center">Comment Sheet</th>
      <th width="20%" height="2%" valign="top" align="center">Deadline Date/Time</th>
      <th width="8%" height="2%" valign="top" align="center">Comments Submitted</th>
      <th width="8%" height="2%" valign="top" align="center">Responses Submitted</th>
    <th width="8%" height="2%" valign="top" align="center">Comments Approved</th>
</tr>


END_HTML;

while (($aRow = odbc_fetch_array($rResult)) !== False) {

     $startdate = date('m/d/Y');
       $eventdate = $aRow['Months']."/".$aRow['Dates']."/".$aRow['Years'];

     foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
          $$sColumnName = ($aRow[$sColumnName] === '1')?' CHECKED':'';
     }
$sOutput .= <<< END_HTML

<tr>
      <td width="10%" height="5%" valign="top" align="center">{$aRow['Date']}</td>
      <td width="14%" height="5%" valign="top" align="center">{$aRow['User']}</td>
      <td width="26%" height="5%" valign="top" align="center"><a href="{$aRow['FilePath']}" target="_blank">{$aRow['FilePathName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center"><a href="{$aRow['CommentSheet']}" target="_blank">{$aRow['CommentName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center">{$aRow['Dates']}/{$aRow['Months']}/{$aRow['Years']} @ {$aRow['Hours']}:{$aRow['Minutes']}:{$aRow['Seconds']}<br/>
      <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="ResponsesSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$ResponsesSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsApproved" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsApproved}></td>

<?php
if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1){
?>
      <span style="color:red;"><b>This Document is overdue</b></span>
<?php
}
elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1)
{
?>
      <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>
<?php
}
else
{
      <span style="color:black;"><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</span>
<?php
}
?>
</td>
</tr>

END_HTML;
}

$sOutput .= <<< END_HTML
</table>
$sResponse
</body>
</html>
END_HTML;

echo $sOutput;
?>

cheers

sean
0
hernst42Commented:
Its very easy. replace the
<?php with $sOutput .= <<< END_HTML
and
\s*?> with END_HTML;

\s* means any whitespace like tab or spaces before the ?>.

where you have those tag inside such an here-doc/ if condition
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ellandrdAuthor Commented:
ok forever add your answer to my code, ive updated it:

but ive got an extra $end somwhere so can you take a look??

<tr>
      <td width="10%" height="5%" valign="top" align="center">{$aRow['Date']}</td>
      <td width="14%" height="5%" valign="top" align="center">{$aRow['User']}</td>
      <td width="26%" height="5%" valign="top" align="center"><a href="{$aRow['FilePath']}" target="_blank">{$aRow['FilePathName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center"><a href="{$aRow['CommentSheet']}" target="_blank">{$aRow['CommentName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center">{$aRow['Dates']}/{$aRow['Months']}/{$aRow['Years']} @ {$aRow['Hours']}:{$aRow['Minutes']}:{$aRow['Seconds']}<br/>
      <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="ResponsesSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$ResponsesSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsApproved" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsApproved}></td>

END_HTML;

if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1){

$sOutput .= <<< END_HTML

      <span style="color:red;"><b>This Document is overdue</b></span>


END_HTML;


}
elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1)
{

$sOutput .= <<< END_HTML

      <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>

END_HTML;
}
else
{
$sOutput .= <<< END_HTML

      <span style="color:black;"><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</span>

END_HTML;


}

?>

</td>
</tr>

END_HTML;
}

$sOutput .= <<< END_HTML
</table>
$sResponse
</body>
</html>
END_HTML;

echo $sOutput;?>

somewhere in this part of code i think?

sean

0
ellandrdAuthor Commented:
still displaying "days remaining" and "document overdue" together!

somw how my if statements arent working...

any ideas

sean
0
ellandrdAuthor Commented:
heres my updated code:

<?php

error_reporting(E_ALL); // Activate ALL errors/warnings/notices.

print_r($_POST); // Show the POST array in all its glory.

$rConn = odbc_connect("ConnLink","","");

// Check the results
$sResponse = '';

foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
      if (isset($_POST[$sColumnName])) {
            $sSQL = "UPDATE tblDataDocsReview SET $sColumnName = {$_POST[$sColumnName]} WHERE ID_no={$_POST['ID_no']};";
            // echo $sSQL; // Lets see what the query REALLY says.
            $rResult = odbc_exec($rConn, $sSQL) or die('Problem with the query.');
            // You may want to build a $sResponse to be put at the bottom of the page.
      }
}

// Get new results.
$rResult = odbc_exec ($rConn,"SELECT * FROM tblDataDocsReview");

$sOutput = <<< END_HTML
<html>
<head>
<meta http-equiv="refresh" content="50,defaults.php">
<style type="text/css">
      .global {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;}
      .tbl,td {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;border-bottom-style: solid;border-bottom-color: black;border-bottom-width: 1px;border-left-style: solid;border-left-color: black;border-left-width: 1px;border-top-style: solid;border-top-color: black;border-top-width: 1px;border-right-style: solid;border-right-color: black;border-right-width: 1px;cellpadding:0;cellspacing:0;}
      a{font-family:Trebuchet MS;font-size:12px;}
      a:visited{font-family:Trebuchet MS;font-size:12px;}
      a:hover{font-family:Trebuchet MS;font-size:12px;font-weight:bold;}
      a:active{font-family:Trebuchet MS;font-size:12px;}
</style>
<script language="JavaScript">
<!--
bAllowSubmit = true;

function SubmitForm(obj, uid) {
      if (bAllowSubmit == true) {
            bAllowSubmit = false; // Stop multiple clicks.
            document.HiddenForm.HiddenField.name = obj.name;
            if (obj.checked == true) {
                  document.HiddenForm.HiddenField.value = 1;
            } else {
                  document.HiddenForm.HiddenField.value = 0;
            }
            document.HiddenForm.UniqueID.value = uid;
            document.HiddenForm.submit();
      }
}


status = "BP - Project Endeavour - Tie-in Spool Execute Phrase";

var message = "Sorry! Right Click Disabled";

function clickIE4() {
      if (event.button == 2) {
            alert(message);
            return false;
      }
}

function clickNS4(e) {
      if (document.layers || document.getElementById && !document.all) {
            if (e.which == 2 || e.which == 3) {
                  alert(message);
                  return false;
            }
      }
}

if (document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = clickNS4;
} else if (document.all && !document.getElementById) {
      document.onmousedown = clickIE4;
}
document.oncontextmenu = new Function("alert(message);return false")


//-->
</script>
</head>
<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="24" bgcolor="white">
<form name="HiddenForm" method="POST" action="{$_SERVER['PHP_SELF']}">
     <input type="hidden" id="HiddenField" name="" value="">
     <input type="hidden" id="UniqueID" name="ID_no" value="">
</form>
<p class="global">Documents to be reviewed are as follows:</p>
<table width="97.5%" class="tbl">
<tr>
      <th width="10%" height="2%" valign="top" align="center">Entry Date</th>
      <th width="14%" height="2%" valign="top" align="center">Actionee</th>
      <th width="26%" height="2%" valign="top" align="center">Document to be Reviewed</th>
      <th width="20%" height="2%" valign="top" align="center">Comment Sheet</th>
      <th width="20%" height="2%" valign="top" align="center">Deadline Date/Time</th>
      <th width="8%" height="2%" valign="top" align="center">Comments Submitted</th>
      <th width="8%" height="2%" valign="top" align="center">Responses Submitted</th>
    <th width="8%" height="2%" valign="top" align="center">Comments Approved</th>
</tr>


END_HTML;

while (($aRow = odbc_fetch_array($rResult)) !== False) {

     $startdate = date('m/d/Y');
       $eventdate = $aRow['Months']."/".$aRow['Dates']."/".$aRow['Years'];

     foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
          $$sColumnName = ($aRow[$sColumnName] === '1')?' CHECKED':'';
     }


$sOutput .= <<< END_HTML

<tr>
      <td width="10%" height="5%" valign="top" align="center">{$aRow['Date']}</td>
      <td width="14%" height="5%" valign="top" align="center">{$aRow['User']}</td>
      <td width="26%" height="5%" valign="top" align="center"><a href="{$aRow['FilePath']}" target="_blank">{$aRow['FilePathName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center"><a href="{$aRow['CommentSheet']}" target="_blank">{$aRow['CommentName']}</a></td>
      <td width="20%" height="5%" valign="top" align="center">{$aRow['Dates']}/{$aRow['Months']}/{$aRow['Years']} @ {$aRow['Hours']}:{$aRow['Minutes']}:{$aRow['Seconds']}<br/>
      <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="ResponsesSubmitted" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$ResponsesSubmitted}></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsApproved" value=0 onClick="SubmitForm(this, {$aRow['ID_no']});"{$CommentsApproved}></td>

END_HTML;

if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1){

$sOutput .= <<< END_HTML

      <span style="color:red;"><b>This Document is overdue</b></span>


END_HTML;


}
elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1)
{

$sOutput .= <<< END_HTML

      <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>

END_HTML;
}
else
{
$sOutput .= <<< END_HTML

      <span style="color:black;"><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</span>

END_HTML;


}
$sOutput .= <<< END_HTML

</td>
</tr>

END_HTML;
}

$sOutput .= <<< END_HTML
</table>
$sResponse
</body>
</html>
END_HTML;

echo $sOutput;?>

sean
0
hernst42Commented:

$sOutput .= <<< END_HTML

     <span style="color:red;"><b><?php echo round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?> days remaining</b></span>

END_HTML;

Should better be written as the following as it also contains php-tags:

$sOutput .= <<< END_HTML
     <span style="color:red;"><b>
END_HTML;
$sOutput .= round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);
$sOutput .= <<< END_HTML
days remaining</b></span>

END_HTML;
}
else
{
$sOutput .= <<< END_HTML

     <span style="color:black;">
END_HTML;
 $sOutput .= round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0);?>
$sOutput .= <<< END_HTML
days remaining</span>

END_HTML;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ellandrdAuthor Commented:
still not working! it displays doc overdue and days remaining everywhere now...

sean
0
Diablo84Commented:
Theres a lot of html assigned to php that doesn't need to be parsed so i would scrap heredoc and do something like this:

<?php
error_reporting(E_ALL); // Activate ALL errors/warnings/notices.
print_r($_POST); // Show the POST array in all its glory.
?>

<html>
<head>
<meta http-equiv="refresh" content="50,defaults.php">
<style type="text/css">
     .global {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;}
     .tbl,td {font-family:Trebuchet MS;color:black;font-size:12px;text-decoration:none;border-bottom-style: solid;border-bottom-color: black;border-bottom-width: 1px;border-left-style: solid;border-left-color: black;border-left-width: 1px;border-top-style: solid;border-top-color: black;border-top-width: 1px;border-right-style: solid;border-right-color: black;border-right-width: 1px;cellpadding:0;cellspacing:0;}
     a{font-family:Trebuchet MS;font-size:12px;}
     a:visited{font-family:Trebuchet MS;font-size:12px;}
     a:hover{font-family:Trebuchet MS;font-size:12px;font-weight:bold;}
     a:active{font-family:Trebuchet MS;font-size:12px;}
</style>
<script language="JavaScript">
<!--
bAllowSubmit = true;

function SubmitForm(obj, uid) {
     if (bAllowSubmit == true) {
          bAllowSubmit = false; // Stop multiple clicks.
          document.HiddenForm.HiddenField.name = obj.name;
          if (obj.checked == true) {
               document.HiddenForm.HiddenField.value = 1;
          } else {
               document.HiddenForm.HiddenField.value = 0;
          }
          document.HiddenForm.UniqueID.value = uid;
          document.HiddenForm.submit();
     }
}


status = "BP - Project Endeavour - Tie-in Spool Execute Phrase";

var message = "Sorry! Right Click Disabled";

function clickIE4() {
     if (event.button == 2) {
          alert(message);
          return false;
     }
}

function clickNS4(e) {
     if (document.layers || document.getElementById && !document.all) {
          if (e.which == 2 || e.which == 3) {
               alert(message);
               return false;
          }
     }
}

if (document.layers) {
     document.captureEvents(Event.MOUSEDOWN);
     document.onmousedown = clickNS4;
} else if (document.all && !document.getElementById) {
     document.onmousedown = clickIE4;
}
document.oncontextmenu = new Function("alert(message);return false")


//-->
</script>
</head>
<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="24" bgcolor="white">
<form name="HiddenForm" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
     <input type="hidden" id="HiddenField" name="" value="">
     <input type="hidden" id="UniqueID" name="ID_no" value="">
</form>
<p class="global">Documents to be reviewed are as follows:</p>
<table width="97.5%" class="tbl">
<tr>
     <th width="10%" height="2%" valign="top" align="center">Entry Date</th>
     <th width="14%" height="2%" valign="top" align="center">Actionee</th>
     <th width="26%" height="2%" valign="top" align="center">Document to be Reviewed</th>
     <th width="20%" height="2%" valign="top" align="center">Comment Sheet</th>
     <th width="20%" height="2%" valign="top" align="center">Deadline Date/Time</th>
     <th width="8%" height="2%" valign="top" align="center">Comments Submitted</th>
     <th width="8%" height="2%" valign="top" align="center">Responses Submitted</th>
    <th width="8%" height="2%" valign="top" align="center">Comments Approved</th>
</tr>

<?php
$rConn = odbc_connect("ConnLink","","");

// Check the results
$sResponse = '';

foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
 if (isset($_POST[$sColumnName])) {
  $sSQL = "UPDATE tblDataDocsReview SET $sColumnName = '{$_POST[$sColumnName]}' WHERE ID_no = '{$_POST['ID_no']}';";
  $rResult = odbc_exec($rConn, $sSQL) or die('Problem with the query.');
 }
}

// Get new results.
$rResult = odbc_exec ($rConn,"SELECT * FROM tblDataDocsReview");
$sOutput = "";

while (($aRow = odbc_fetch_array($rResult)) !== false) {
 $startdate = date('m/d/Y');
 $eventdate = $aRow['Months']."/".$aRow['Dates']."/".$aRow['Years'];

 foreach(array('CommentsSubmitted', 'ResponsesSubmitted', 'CommentsApproved') as $sColumnName) {
  $$sColumnName = ($aRow[$sColumnName] == '1') ? ' CHECKED' : '';
 }


 $sOutput .= '
 <tr>
     <td width="10%" height="5%" valign="top" align="center">'.$aRow['Date'].'</td>
     <td width="14%" height="5%" valign="top" align="center">'.$aRow['User'].'</td>
     <td width="26%" height="5%" valign="top" align="center"><a href="'.$aRow['FilePath'].'" target="_blank">'.$aRow['FilePathName'].'</a></td>
     <td width="20%" height="5%" valign="top" align="center"><a href="'.$aRow['CommentSheet'].'" target="_blank">'.$aRow['CommentName'].'</a></td>
     <td width="20%" height="5%" valign="top" align="center">'.$aRow['Dates'].'/'.$aRow['Months'].'/'.$aRow['Years'].' @ '.$aRow['Hours'].':'.$aRow['Minutes'].':'.$aRow['Seconds'].'<br/>
     <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsSubmitted" value=0 onClick="SubmitForm(this, '.$aRow['ID_no'].');"'.$CommentsSubmitted.'></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="ResponsesSubmitted" value=0 onClick="SubmitForm(this, '.$aRow['ID_no'].');"'.$ResponsesSubmitted.'></td>
    <td width="8%" height="5%" valign="top" align="center"><input type="checkbox" name="CommentsApproved" value=0 onClick="SubmitForm(this, '.$aRow['ID_no'].');"'.$CommentsApproved.'></td>';

 if ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= -1) {
  $sOutput .= '<span style="color:red;"><b>This Document is overdue</b></span>';
 }
 elseif ((strtotime($eventdate)-strtotime($startdate))/(60.0*60.0*24.0)<= 1) {
  $sOutput .= '<span style="color:red;"><b>'.round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0).' days remaining</b></span>';
 }
 else {
  $sOutput .= '<span style="color:black;">'.round((strtotime($eventdate)-(int)strtotime($startdate))/(60.0*60.0*24.0),0).' days remaining</span>';
 }

}

echo $sOutput;
?>


</td>
</tr>
</table>

<?php echo $sResponse; ?>

</body>
</html>
0
ellandrdAuthor Commented:
sorry got my code working with hernst42.  using heredoc wasnt the problem to why my "days remaining" wasnt seeting in the correct place was i had <td> tag in wrong place....

thanks guys for all the help!

sean
0
Diablo84Commented:
Your code would still be more efficient with the above.

.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.