How do I get a cell in a php table to be a link?

Tim P

New member
This is my entire code for a page, but I'm looking to have the first names in the table as a link. The link connects to an update/delete page.

<?php
$connection = new COM("ADODB.Connection");
$connectionString = "Driver={MySQL ODBC 3.51 Driver};Server=deptcis3.fvtc.edu;Database=**************;User=**************; Password=*************;Option=3;";
$connection->open($connectionString);
$strSQL = "Select * from customerinfo;";
$recordset = $connection->execute($strSQL);
$strCustomerID = $recordset->Fields("CustomerID");
$strFirstName = $recordset->Fields("FirstName");
$strLastName = $recordset->Fields("LastName");
$strAddress = $recordset->Fields("Address");
$strCity = $recordset->Fields("City");
$strState = $recordset->Fields("State");
$strZip = $recordset->Fields("Zip");
$strPhone = $recordset->Fields("Phone");
$strEMail = $recordset->Fields("EMail");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>

<body>

<table width="350" border="1" align="center">
<tr>
<th width="50%">Customer ID</th>
<th width="50%">First Name</th>
<th width="50%">Last Name</th>
<th width="50%">Address</th>
<th width="50%">City</th>
<th width="50%">State</th>
<th width="50%">Zip Code</th>
<th width="50%">Phone</th>
<th width="50%">Email</th>
</tr>

<a href="project12form.php?CustomerID=1">Winston</a>
<a href="project12form.php?CustomerID=2">Amanda</a>
<a href="project12form.php?CustomerID=3">Stan</a>
<a href="project12form.php?CustomerID=4">Anita</a>
<a href="project12form.php?CustomerID=5">Marge</a>
<a href="project12form.php?CustomerID=6">Marian</a>
<a href="project12form.php?CustomerID=7">Warren</a>
<a href="project12form.php?CustomerID=8">Rhonda</a>
<a href="project12form.php?CustomerID=9">Jose</a>
<a href="project12form.php?CustomerID=10">Karen</a>
<a href="project12form.php?CustomerID=11">asdf</a>
<a href="project12form.php?CustomerID=12">Tim</a><?php


while (!$recordset->EOF)
{

print("<tr>
<td>$strCustomerID</td>
<td>$strFirstName</td>
<td>$strLastName</td>
<td>$strAddress</td>
<td>$strCity</td>
<td>$strState</td>
<td>$strZip</td>
<td>$strPhone</td>
<td>$strEMail</td>
</tr>");
$recordset->MoveNext();
}

?>

</table>

<?php
$recordset->Close();
$connection->Close();
$recordset=null;
$connection=null;
?>

</body>
</html>
 
Back
Top