I have created a simple mysql databse which stores all of the enquiry data that the user submits via an html form. (This bit works)
I have a seperate page where the user can search the surname column and return the entire row. (This bit also works)
I now want to add a checkbox to the end of each row in the returned search, and a button at the bottom of the page which will direct the user to a page where they can then update the data and save it.
Here is my search code so far:
Code: Select all
<?php
mysql_connect ("localhost", "MyUsername", "MyPassword") or die (mysql_error());
mysql_select_db ("enquiries");
$search1 = $_POST['search1'];
$sql = mysql_query("select * FROM enquiry WHERE surname LIKE '%$search1%'");
echo "Your search for <u><strong>$search1</strong></u> returned the following results:<br />";
echo "<br />";
print ('<table style="border-width: thin; border-style: solid; border-color: grey; cellpadding=1; border-width: 2px;">');
print '<tr bgcolor="grey">';
print '<td width="9%"><t><strong>ENTRY DATE</strong></t></td>';
print '<td width="4%"><t><strong>TITLE</strong></t></td>';
print '<td width="9%"><t><strong>FIRST NAME</strong></t></td>';
print '<td width="8%"><t><strong>SURNAME</strong></t></td>';
print '<td width="8%"><t><strong>DOB</strong></t></td>';
print '<td width="10%"><t><strong>ADDRESS 1</t></strong></td>';
print '<td width="10%"><t><strong>ADDRESS 2</t><strong></td>';
print '<td width="10%"><t><strong>ADDRESS 3</t></strong></td>';
print '<td width="10%"><t><strong>POST CODE</t></strong></td>';
print '<td width="20%"><t><strong>EMAIL</t></strong></td>';
print '<td width="11%"><t><strong>SELECT</t></strong></td>';
print '</tr>';
while ($row = mysql_fetch_array( $sql ))
{
print '<tr bgcolor="lightgrey">';
print '<td width="9%"><t>'.$row['date'].'</t></td>';
print '<td width="4%"><t>'.$row['title'].'</t></td>';
print '<td width="9%"><t>'.$row['firstname'].'</t></td>';
print '<td width="8%"><t>'.$row['surname'].'</t></td>';
print '<td width="8%"><t>'.$row['dob'].'</t></td>';
print '<td width="10%"><t>'.$row['address1'].'</t></td>';
print '<td width="10%"><t>'.$row['address2'].'</t></td>';
print '<td width="10%"><t>'.$row['address3'].'</t></td>';
print '<td width="10%"><t>'.$row['postcode'].'</t></td>';
print '<td width="20%"><t>'.$row['email'].'</t></td>';
print '<td width="11%" align="center"><form action="update.php" method="post"><input name="check" type="checkbox" value="Yes" /></td>';
print '</tr>';
}
print '</table><br />';
print '<input name="edit" type="button" value="Edit" />';
print '<input name="letter" type="button" value="Create Letter" /></form>';
?>Any help would be appreciated.
Thanks