Jump to content

[SOLVED] Not sure if this a php or html problem


SkyRanger

Recommended Posts

I am having a problem with this table.  First I will post the full code then below that I will post the problem code and explain the problem further:

 

 <?php

$ticketno = $_GET["ticketno"];
include "../inc/config.inc.php";
// database connect script.
$connection=mysql_connect ("$dbhost", "$dbuname", "$dbpass") or die ('I cannot connect to the database because: ' . mysql_error());
        mysql_select_db ("$dbname");
        //set up the query
$querypl = mysql_db_query("$dbname", "SELECT * FROM support WHERE ticketno = '$ticketno'")
or die("Unable to select Database");
$rowpl = mysql_num_rows($querypl);
while ($rowpl = mysql_fetch_array($querypl)) {
$sticketno = $rowpl["ticketno"];
$susername = $rowpl["username"];
$semail = $rowpl["email"];
$sdomain = $rowpl["domain"];
$ssubject = $rowpl["subject"];
$smessage = $rowpl["description"];
$sstatus = $rowpl["status"];
$sdate = $rowpl["date"];
                }

if( isset($_POST['submit'])) {
// process form

$formmessage = $_POST["formmessage"];
$postername = $myusername;

// database connect script.
include "../inc/config.inc.php";
// database connect script.
$connection=mysql_connect ("$dbhost", "$dbuname", "$dbpass") or die ('I cannot connect to the database because: ' . mysql_error());
        mysql_select_db ("$dbname");
        mysql_db_query("$dbname", "UPDATE support SET status = 'pending' WHERE ticketno = '$ticketno'") or die('I cannot update the database because: ' . mysql_error());

$sql = "INSERT INTO support_replies (ticketno,description,date,user) VALUES ('$ticketno','$formmessage','time()','$postername')";
$result = mysql_query($sql) or die ('I could not add information to the database because ' . mysql_error());

echo "<b>Your request has been sent.</b><br>Please click here to return to the $dbcompany Manager Index:<br><a href=index2.php>$dbcompanyManager Index</a>";

} else{

?>
        <form method="post" action=<?PHP echo $PHP_SELF?>>
        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber10" height="8" valign="top">
          <tr>
            <td width="84%" align="center" height="5" valign="top" colspan="2" bgcolor="#A3A3D6">
            Ticket Number: <?php echo $ticketno; ?></td>
            </tr>
          <input type="hidden" name="ticketno" value=<?php echo $ticketno ?>>
          <tr>
            <td width="21%" align="right" height="7" valign="top" bgcolor="#9999FF">
            User:</td>
            <td width="63%" align="left" height="7" valign="top">
            <?php echo $susername ?></td>
            </tr>
          <tr>
            <td width="21%" align="right" height="5" valign="top" bgcolor="#9999FF">
            Email:</td>
            <td width="63%" align="left" height="5" valign="top">
            <a href=email.php?aemail=<?php echo $semail ?>><?php echo $semail ?></a></td>
            </tr>
          <tr>
            <td width="21%" align="right" height="6" valign="top" bgcolor="#9999FF">
            <p style="margin-right: 5">Domain:</td>
            <td width="63%" align="left" height="6" valign="top">
            <a href=http://<?php echo $sdomain ?> target="new"><?php echo $sdomain ?></a></td>
            </tr>
          <tr>
            <td width="21%" align="right" height="7" valign="top" bgcolor="#9999FF">
            Date:</td>
            <td width="63%" align="left" height="7" valign="top">
            <?php echo $sdate ?></td>
            </tr>
          <tr>
            <td width="21%" align="right" height="5" valign="top" bgcolor="#9999FF">
            Subject:</td>
            <td width="63%" align="left" height="5" valign="top">
            <?php echo $ssubject ?></td>
            </tr>
          <tr>
            <td width="21%" align="right" height="7" valign="top" bgcolor="#9999FF">
            Original Question:</td>
            <td width="63%" align="left" height="7" valign="top" bgcolor="#66CCFF">
            <?php echo nl2br("$smessage"); ?></td>
            </tr>
          <?php
$querysr = mysql_db_query("$dbname", "SELECT * FROM `support_replies` WHERE ticketno = '$ticketno'")
or die("Unable to select Database");
$rowsr = mysql_num_rows($querysr);
while ($rowsr = mysql_fetch_array($querysr)) {
$srticketno = $rowsr["ticketno"];
$srmessage = $rowsr["description"];
$srdate = $rowsr["date"];
$sruser = $rowsr["user"];

if($rownumber == "0"){
echo nl2br("<tr>
            <td width=\"21%\" align=\"right\" bgcolor=\"#EEEEF8\"><font color=\"#000000\">$sruser:</font></td>
            <td width=\"63%\" align=\"left\" bgcolor=\"#EEEEF8\"><font color=\"#000000\">$srmessage</font></td>
            </tr>");
$rownumber = "1";
} else {
echo nl2br("<tr>
            <td width=\"21%\" align=\"right\" valign=\"top\" bgcolor=\"#FBF7D7\"><font color=\"#000000\">$sruser:</font></td>
            <td width=\"63%\" align=\"left\" valign=\"top\" bgcolor=\"#FBF7D7\"><font color=\"#000000\">$srmessage</font></td>
            </tr>");
$rownumber = "0";
}
                }
?>
<tr>
            <td width="21%" align="right" height="6" valign="top" bgcolor="#9999FF">
            Add to Call:</td>
            <td width="63%" align="left" height="6" valign="top">
            <p><textarea name="formmessage" cols="35" rows="6" wrap="true"></textarea></td>
            </tr>
          <tr>
            <td width="84%" align="right" height="7" valign="top" bgcolor="#666699" colspan="2">
             </td>
            </tr>
          <tr>
            <td width="84%" align="right" height="8" valign="top" bgcolor="#666699" colspan="2">
            <p align="center"><input type="Submit" name="submit" value="Send Reply"></form></td>
            </tr>
          <tr>
            <td width="84%" align="right" height="3" valign="top" bgcolor="#666699" colspan="2">
            <p align="center"><a href=deletehd.php?ticketno=<?php echo $ticketno ?>>Delete Message</a> OR <a href=closehd.php?ticketno=<?php echo $ticketno ?>>Close Message</a>
</td>
            </tr>
        <?
         }
        ?>
        </table>

 

Problem Code:

if($rownumber == "0"){
echo nl2br("<tr>
            <td width=\"21%\" align=\"right\" bgcolor=\"#EEEEF8\"><font color=\"#000000\">$sruser:</font></td>
            <td width=\"63%\" align=\"left\" bgcolor=\"#EEEEF8\"><font color=\"#000000\">$srmessage</font></td>
            </tr>");
$rownumber = "1";
} else {
echo nl2br("<tr>
            <td width=\"21%\" align=\"right\" valign=\"top\" bgcolor=\"#FBF7D7\"><font color=\"#000000\">$sruser:</font></td>
            <td width=\"63%\" align=\"left\" valign=\"top\" bgcolor=\"#FBF7D7\"><font color=\"#000000\">$srmessage</font></td>
            </tr>");
$rownumber = "0";
}

 

The problem I am having with this code is that it is forcing my table farther down the page and leaving white space at the top.  If you need further information please ask.  Not sure if I posted everything that is needed.

 

When I remove the problem code.  The table displays properly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.