This page is an XHTML Page with PHP. called company.php. This should show all the details of the company defined by the URL (e.g. company.php?id=1 should show the details of the company with id 1). I have a link on this page that should take you to showemail.php?id= the same id as before (e.g. 7) but instead takes you to showemail.php?id=$id or showemail.php?id='$id' or showemail.php?id=('$id'). What should this be??
<?php require_once('Connections/company.php'); ?>
<?php
$colname_showdata = "-1";
if (isset($_GET['id'])) {
$colname_showdata = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_company, $company);
$query_showdata = sprintf("SELECT id, name, address1, address2, towncity, county, phone, fax, email, website, job, description FROM company_details WHERE id = %s", $colname_showdata);
$showdata = mysql_query($query_showdata, $company) or die(mysql_error());
$row_showdata = mysql_fetch_assoc($showdata);
$totalRows_showdata = mysql_num_rows($showdata);
$id = $row_showdata['id']
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MyTown - <?php echo $row_showdata['name']; ?> Details</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p> </p>
<?php if ($totalRows_showdata > 0) { // Show if recordset not empty ?>
<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="156" align="right" valign="top"><p>Company Name:</p></td>
<td width="338"><?php echo ucfirst($row_showdata['name']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Address Line 1: </td>
<td><?php echo ucfirst($row_showdata['address1']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Address Line 2: </td>
<td><?php echo ucfirst($row_showdata['address2']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Town/City:</td>
<td><?php echo ucfirst($row_showdata['towncity']); ?></td>
</tr>
<tr>
<td align="right" valign="top">County:</td>
<td><?php echo ucfirst($row_showdata['county']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Phone:</td>
<td><?php echo $row_showdata['phone']; ?></td>
</tr>
<tr>
<td align="right" valign="top">Fax:</td>
<td><?php echo $row_showdata['fax']; ?></td>
</tr>
<tr>
<td align="right" valign="top">Email:</td>
<td><a href="showemail.php?id=('$id')">Show Email Address</a></td>
</tr>
<tr>
<td align="right" valign="top">Website:</td>
<td><?php echo strtolower($row_showdata['website']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Job/Trade:</td>
<td><?php echo ucfirst($row_showdata['job']); ?></td>
</tr>
<tr>
<td align="right" valign="top">Description:</td>
<td><?php echo ucfirst($row_showdata['description']); ?></td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_showdata == 0) { ?>
<p>Sorry, an Error Occured </p>
<?php } // Show if recordset empty ?></body>
</html>
<?php
mysql_free_result($showdata);
mysql_free_result($showdetails);
?>