I have a piece of code that is supposed to take a variable passed from another page to determin font size. It isn't working properly, it is passing the variable, and it is assigning the proper values to the secondary font vars. The problem is that when parsed the variables aren't showing up in the html, here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?
if ($font == "l") {
$font1 = "5";
$font2 = "3"; }
if ($font == "m") {
$font1 = "4";
$font2 = "2";}
if ($font == "s") {
$font1 = "3";
$font2 = "1"; }
$dateent = date("m/d/Y");
?>
<?
function writetable($job)
{
if ($hours = "All" || $jobstatus = "Active") {
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("hprhs1",$db);
$result = mysql_query("SELECT * FROM joblist WHERE jobtype like '$job' ",$db);
$results = mysql_query("SELECT count(id) FROM joblist WHERE jobtype like '$job' and jobstatus = 'Active' ",$db);
$row = mysql_fetch_array($results);
//echo "There are $row[0] matching entries in the database.";
$number = round($row[0]/2);
$count=1;
if ($myrow = mysql_fetch_array($result)) {
printf("<tr>\n<td colspan=2 align=center><b><FONT SIZE='$font1'>%s</FONT></b>\n", $myrow["jobtype"]);
echo "</td>\n</tr>\n<tr><TD VALIGN='top' WIDTH='50%'>";
//echo "<table border=0>\n";
//printf("<tr><td valign=top>\n");
while ($myrow = mysql_fetch_array($result)) {
if ($myrow[jobstatus] == 'Active') {
printf("<FONT SIZE=$font2><B>%s/%s<BR></B>%s %s.</FONT><br>\n", $myrow["jobtitle"], $myrow["deptname"], $myrow["jobreq"], $myrow["workhours"]);
$count = $count + 1;
if ($count == $number){
printf("</td>\n<td valign=top>\n"); }
}
}
}
}
printf("</tr>\n");
}
?>
<head>
<title>Professional/General Search</title>
</head>
<body>
<TABLE ID="Table1" BORDER=0 CELLSPACING=1 CELLPADDING=1 align=center>
<TR><TD><? printf("<tr><td colspan=2 align=center><b><font size='$font1'>Date: $dateent</td></tr>\n"); ?></TD></TR>
<tr><td>
<? writetable("Professional/Technical"); ?>
<? writetable("General Opportunities"); ?>
</td></tr>
</TABLE>
</body>
Everything works great and as expected except the font, the font does seem to work for the part that uses $font1, but doesn't work with $font2.
Any help appreciated.
moonie 😉