Below is an excerpt from a PHP script that I have been using. The entire script is kind of large and
cumbersome. This one portion of the script is long horizontally and goes off the screen to the right.
I am at a point in my programming career that I need to begin using "classes" and "templates"
so I figure that this is a good place to start.
I've got the general idea about how PHP object oriented programming works. It's just the details
for which I need more of a grasp.
Can anyone give me any ideas about how I can separate the HTML from the PHP in the below script?
In other words, I need a template for the HTML, a class for the PHP/MySQL database extraction
function, and an instance to call the whole thing.
I would appreciate any pointers about how I might get started.
echo "<form method=\"post\" action=\"$PHP_SELF\">";
require_once "../conf/config.inc.php";
$TableName = "InsuranceQuote";
$Query = "SELECT * FROM $TableName";
$Result = mysql_db_query ($db_info[dbname], $Query, $db_connection);
echo "<table border=\"1\" class=\"one\" cellspacing=\"0\" cellpadding=\"5\">";
while ($Row = mysql_fetch_array($Result)){
echo "<tr><td><input type=\"checkbox\" name=\"Reference\" value=\"".$Row["Reference"]."\"></td><td>".$Row["Salute"]."</td><td>".$Row["FirstName"]."</td><td>".$Row["Middle"]."</td><td>".$Row["LastName"]."</td><td>".$Row["Address"]."</td><td>".$Row["City"]."</td><td>".$Row["State"]."</td><td>".$Row["Zip"]."</td><td>".$Row["DayPhone"]."</td><td>".$Row["EvePhone"]."</td><td>".$Row["MailAdd"]."</td><td>".$Row["Age"]."</td><td>".$Row["BirthYear"]."</td><td>".$Row["Gender"]."</td><td>".$Row["Tobacco"]."</td><td>".$Row["HeightFeet"]."' - ".$Row["HeightInches"]."\"</td><td>".$Row["Weight"]."</td><td>".$Row["Medication"]."</td><td>".$Row["HealthProblems"]."</td></tr>\n";
}
echo "<tr><td colspan=\"20\" align=\"left\"><input type=\"submit\" name=\"DeleteCancerExpense\" value=\"Click Here To Delete\"></td></tr></form>";
echo "</table><hr size=\"5\">";
Thanking you in advance.
Volitics