I finished my data entry forms and results forms (the one's that included math) - thanks for everybody's help! : )
Now I'm working on a details page that shows the results of one of the records selected in the previous page. The ID is passed by URL.
Ok, the reason I'm writing to the forum is because my code isn't working. Here's the error I'm currently getting:
Parse error: syntax error, unexpected '<' in d:\survey_detail.php on line 2
Here's the current code:
PHP Code:
<?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Survey Results</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#FFFFFF" text="#999999" link="#336699" vlink="#666666">
<table width="705" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><a href="http://www.alaska.edu/uacp/"><img src="i/uacp.gif" alt="uacp" name="uacp" width="291" height="116" border="0" id="uacp" /></a><img src="i/line.gif" alt="" name="line" width="353" height="116" border="0" id="line" /><a href="survey.cfm"><img src="i/home.gif" alt="home page" name="home" width="61" height="116" border="0" id="home" /></a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
if (is_numeric($_GET['ID'])) {
$db_name = "UACP";
$table_name = "survey";
$connection = @mysql_connect("host", "user", "password") OR die('Could not connect to MySQL: ' . mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$query = "SELECT ID,client,uacpstaff,DATE_FORMAT(surveydate,'%b %d,%Y') AS surveydate,
DATE_FORMAT(servicedate,'%c/%e/%y') AS servicedate,servicedesc,knowledge,knowledgec,response,responsec,
courtesy,courtesyc,comm,commc,ownership,ownershipc,service,servicec,improve,comments,contact
FROM $table_name WHERE ID = {$_GET['ID']}";
$result = mysql_query($query);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$avg = ({row['knowledge']} + {row['response']} + {row['courtesy']} + {row['comm']} + {row['ownership']} +
{row['service']})/6;
mysql_close();
echo "
<table border="1" cellpadding="5" cellspacing="0">
<tr valign="top">
<td>Client</td>
<td colspan="2"><p>{$row['client']}</p></td>
</tr>
<tr valign="top">
<td>UACP Staff</td>
<td colspan="2"><p>{$row['uacpstaff']}</p></td>
</tr>
<tr valign="top">
<td>Contact</td>
<td colspan="2">
if {$row['contact']} = 'yes' {
print 'Please contact us regarding this survey.';
}
else {
print 'Do not contact us regarding this survey.';
}
</td>
</tr>
<tr valign="top">
<td>Survey Date</td>
<td colspan="2">{$row['surveydate']}</td>
</tr>
<tr valign="top">
<td>Survey Avg</td>
<td colspan="2">print $avg;</td>
</tr>
<tr valign="top">
<td>Service Date</td>
<td colspan="2">{$row['servicedate']}</td>
</tr>
<tr valign="top">
<td>Service Description</td>
<td colspan="2">{$row['servicedesc']}</td>
</tr>
<tr valign="top">
<td>Knowledge/Ability</td>
<td nowrap="nowrap">
if ({$row['knowledge']} = 1) {
print "Poor";
}
elseif ({$row['knowledge']} = 2) {
print "Fair";
}
elseif ({$row['knowledge']} = 3) {
print "Satisfactory";
}
elseif ({$row['knowledge']} = 4) {
print "Good";
}
elseif ({$row['knowledge']} = 5) {
print "Excellent";
}
else ({$row['knowledge']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['knowledgec']}
</td>
</tr>
<tr valign="top">
<td>Response Speed</td>
<td nowrap="nowrap">
if ({$row['response']} = 1) {
print "Poor";
}
elseif ({$row['response']} = 2) {
print "Fair";
}
elseif ({$row['response']} = 3) {
print "Satisfactory";
}
elseif ({$row['response']} = 4) {
print "Good";
}
elseif ({$row['response']} = 5) {
print "Excellent";
}
else ({$row['response']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['responsec']}
</td>
</tr>
<tr valign="top">
<td>Courtesy</td>
<td nowrap="nowrap">
if ({$row['courtesy']} = 1) {
print "Poor";
}
elseif ({$row['courtesy']} = 2) {
print "Fair";
}
elseif ({$row['courtesy']} = 3) {
print "Satisfactory";
}
elseif ({$row['courtesy']} = 4) {
print "Good";
}
elseif ({$row['courtesy']} = 5) {
print "Excellent";
}
else ({$row['courtesy']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['courtesyc']}
</td>
</tr>
<tr valign="top">
<td>Communication</td>
<td nowrap="nowrap">
if ({$row['comm']} = 1) {
print "Poor";
}
elseif ({$row['comm']} = 2) {
print "Fair";
}
elseif ({$row['comm']} = 3) {
print "Satisfactory";
}
elseif ({$row['comm']} = 4) {
print "Good";
}
elseif ({$row['comm']} = 5) {
print "Excellent";
}
else ({$row['comm']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['commc']}
</td>
</tr>
<tr valign="top">
<td>Sense of Ownership</td>
<td nowrap="nowrap">
if ({$row['ownership']} = 1) {
print "Poor";
}
elseif ({$row['ownership']} = 2) {
print "Fair";
}
elseif ({$row['ownership']} = 3) {
print "Satisfactory";
}
elseif ({$row['ownership']} = 4) {
print "Good";
}
elseif ({$row['ownership']} = 5) {
print "Excellent";
}
else ({$row['ownership']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['ownershipc']}
</td>
</tr>
<tr valign="top">
<td>Service</td>
<td nowrap="nowrap">
if ({$row['service']} = 1) {
print "Poor";
}
elseif ({$row['service']} = 2) {
print "Fair";
}
elseif ({$row['service']} = 3) {
print "Satisfactory";
}
elseif ({$row['service']} = 4) {
print "Good";
}
elseif ({$row['service']} = 5) {
print "Excellent";
}
else ({$row['service']} = N/A) {
print "Not Applicable";
}
</td>
<td>
print {$row['servicec']}
</td>
</tr>
<tr valign="top">
<td>Immediate Improvement</td>
<td colspan="2">
print {$row['improve']}
</td>
</tr>
<tr valign="top">
<td>Other Comments</td>
<td colspan="2">
{$row['comments']}
</td>
</tr>
</table>
"
}
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td><p align="left"><a href="survey_results.php">Back to List</a> ::
<a href=\"survey_delete.php?ID={$row['ID']}\">Delete
this Record</a> </p></td>
</tr>
</table>
<p> </p>
</body>
</html>
?>
Thanks for any help anyone is able to provide!
S./