PHP is a dynamic programming language, it's not a different type of "web page." So you'll need to start thinking a little differently.
I understand that I will need to save the template as an .php.
You could, but generally speaking, false, read on . . .
on row 2 in the database in under the column agent_name that i want to insert into a certain area on the template
First, get used to pulling data values by numeric unique columns. Don't do "select * from table where field='some-text-value' " unless you have to, this is slower and can be error prone.
<a href="somescript.php?rec=1234">John Smith</a>
select * from table where id=$_GET['rec'];
You need to dig into cleansing user input too, this is very important. So you get your record, and store the data in variables.
select * from table where id=$_GET['rec'];
$result = mysql_query($query) or die(mysql_error());
if ($row=mysql_fetch_array($result)) {
$agent_name = $row['agent_name'];
$description = $row['description'];
}
Now your template: it can be an HTML file, a text file, doesn't matter, it's all text anyway. The advantage using it as a PHP file is that you can execute PHP instead of markers, in the example below,
<title><?php echo $agent_name ?></title>
So either method works. What you want in it are "markers" or "placeholders". You use something that would never occur normally for your markers. For example,
<html>
<head>
<title>[HEADING]</title>
</head>
<body>
<h1>[HEADING]</h1>
[DESCRIPTION]
</body>
</html>
Then you open the template and substitute the markers for the variables. For later versions of PHP, file_get_contents works as well. I use this method because it's easier to go line by line (I have reasons . . .)
$template='/full/path/to/template.txt';
$fout=null;
$fhandle = fopen($template, "r");
//
if (is_file($template) and $fhandle) {
while (!feof($fhandle)) {
$buffer = fgets($fhandle, 4096);
if (preg_match("/\[HEADING]/",$buffer)) {
$buffer = stripslashes(preg_replace("/\[HEADING\]/",$agent_name,$buffer));
}
if (preg_match("/\[DESCRIPTION]/",$buffer)) {
$buffer = stripslashes(preg_replace("/\[DESCRIPTION\]/",$description,$buffer));
}
$fout .= $buffer;
}
else { $fout = "not a file"; }
echo $fout;
should give you
<html>
<head>
<title>John Smith</title>
</head>
<body>
<h1>John Smith</h1>
This is the description for John Smith.
</body>
</html>
Lots of stuff "left out," but that's the general concept.
Dreamweaver
Ugh. :-) You'll be spending much more time in the code window from here on out. You should also have HomeSite too, if you got it on CD . . . it's in the disk and best.editor.ever.