Problem with Table, Java script and Text Document in PHP
Posted: Fri Jul 11, 2003 1:35 pm
Please take a datail look of my code. When I am displaying the text document get messed up with table area. Any suggestion??? Please...
If anyone interested to see the out put please provide the e-mail address I will send a snap shot oy the messy out put.
<html>
<HEAD>
<style>
.itemBorder { border: 1px solid black }
.itemText { text-decoration: none; color: #FFFFFF; font: 12px Arial, Helvetica }
.crazyBorder { border: 2px outset #663399 }
.crazyText { text-decoration: none; color: #FFCC99; font: Bold 12px Arial, Helvetica }
</style>
</HEAD>
<BODY marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus()" onResize="if (isNS4) nsResizeHandler()">
<table width = 100% height = 100%>
<tr>
<td ALIGN = left width = 20% height = 100%>
<SCRIPT LANGUAGE="JavaScript" src = "TableOfContent.js">
</script>
</td>
<td align = left valign = top width = 50% height = 100%>
<form action = "ShowDomainName.php" Method = "GET">
<?php
require("............");
$link = mysql_connect($host,$user,$pass);
if (!$link)
die("Couldn't connect to MySQL");
mysql_select_db($db)
or die("Couldn't open $db: ".mysql_error());
$table = "Domain";
$result = mysql_query("SELECT Name FROM $table");
if (!$result)
{
print "Query Failed: " .mysql_error();
}
else
{
$num_rows = mysql_num_rows($result);
if(!$submit)
{
if ($num_rows > 0)
{
print "<br>Available number of Domain/Domains : $num_rows <p>";
print "<table border = 1>\n";
while($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field)
print "\t<td>$field</td>\n";
$Domain_Name[] = $field;
print "</tr>\n";
}
print "</table>\n";
?>
</td>
<td align = left valign = top width = 30% height = 100%>
<br>Select any of the domain for more information<br><br>
<select name = "DomainMenu">
<option value></option>
<?php
foreach ($Domain_Name as $Existing_Domain)
print " <option value=\"$Existing_Domain \">$Existing_Domain</option>";
?>
</select>
<input type="submit" value="Show More Info" name="submit">
</form>
<?php
}
else
print "There is no Domain in the Database";
}
else
{
if (isset($_GET['DomainMenu']))
{
$val = $_GET['DomainMenu'];
if ($val != '')
{
$result = mysql_query("SELECT Description FROM $table where Name = '". $_GET['DomainMenu'] ."'");
if (!$result)
{
print "Query Failed: " .mysql_error();
}
else
{
$Domain_Description = mysql_result($result, 0, 'Description');
$string = trim($Domain_Description);
if ($string != '')
{
else
{
print "There is no description for $val";
}
}
}
else
print "Plese Select a Domain and try again";
}
}
}
mysql_close($link);
?>
</td>
</tr>
</table>
</body>
</html>
If anyone interested to see the out put please provide the e-mail address I will send a snap shot oy the messy out put.
<html>
<HEAD>
<style>
.itemBorder { border: 1px solid black }
.itemText { text-decoration: none; color: #FFFFFF; font: 12px Arial, Helvetica }
.crazyBorder { border: 2px outset #663399 }
.crazyText { text-decoration: none; color: #FFCC99; font: Bold 12px Arial, Helvetica }
</style>
</HEAD>
<BODY marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus()" onResize="if (isNS4) nsResizeHandler()">
<table width = 100% height = 100%>
<tr>
<td ALIGN = left width = 20% height = 100%>
<SCRIPT LANGUAGE="JavaScript" src = "TableOfContent.js">
</script>
</td>
<td align = left valign = top width = 50% height = 100%>
<form action = "ShowDomainName.php" Method = "GET">
<?php
require("............");
$link = mysql_connect($host,$user,$pass);
if (!$link)
die("Couldn't connect to MySQL");
mysql_select_db($db)
or die("Couldn't open $db: ".mysql_error());
$table = "Domain";
$result = mysql_query("SELECT Name FROM $table");
if (!$result)
{
print "Query Failed: " .mysql_error();
}
else
{
$num_rows = mysql_num_rows($result);
if(!$submit)
{
if ($num_rows > 0)
{
print "<br>Available number of Domain/Domains : $num_rows <p>";
print "<table border = 1>\n";
while($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field)
print "\t<td>$field</td>\n";
$Domain_Name[] = $field;
print "</tr>\n";
}
print "</table>\n";
?>
</td>
<td align = left valign = top width = 30% height = 100%>
<br>Select any of the domain for more information<br><br>
<select name = "DomainMenu">
<option value></option>
<?php
foreach ($Domain_Name as $Existing_Domain)
print " <option value=\"$Existing_Domain \">$Existing_Domain</option>";
?>
</select>
<input type="submit" value="Show More Info" name="submit">
</form>
<?php
}
else
print "There is no Domain in the Database";
}
else
{
if (isset($_GET['DomainMenu']))
{
$val = $_GET['DomainMenu'];
if ($val != '')
{
$result = mysql_query("SELECT Description FROM $table where Name = '". $_GET['DomainMenu'] ."'");
if (!$result)
{
print "Query Failed: " .mysql_error();
}
else
{
$Domain_Description = mysql_result($result, 0, 'Description');
$string = trim($Domain_Description);
if ($string != '')
{
}print "<h1>Description for ".$_GET['DomainMenu']." </h1>\n";
$Domain_Description = nl2br($Domain_Description);
print "<pre>$Domain_Description</pre>";
else
{
print "There is no description for $val";
}
}
}
else
print "Plese Select a Domain and try again";
}
}
}
mysql_close($link);
?>
</td>
</tr>
</table>
</body>
</html>