Hello, i am trying to create an interface to a MySQL database for access into email addresses by name. I wrote the following code that allows me to view all entries in the database in their appropriate fields. The problem comes in when i want to create a check box next to them. Ive looked through online documentation to no avail, other than telling me how to do this with HTML, which i know. The problem is when this is done with HTML as i have done, they dont appear to the left of each choice but rather at the top of the page in one giant block of check boxes.
print "<DIV ALIGN=\"Left\">";
print "<TABLE WIDTH=100% BORDER=\"1\" CELLPADDING=\"0\" bgcolor=\"#ABDEFC\">";
print "<center><TR><TH>Select</th>";
print "<TH>Name</th>";
print "<TH>Department</th>";
print "<TH>Email</th>";;
print "</center></tr>";
if (isset($order)) {
$sorted=$order;
} else {
$sorted="name";
}
$table="employees";
$result = mysql_query("SELECT * FROM `$table` ORDER BY `$sorted`"
or die("Error: " . mysql_error());
$nb = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$select = "<small>" . str_replace("\n","\n", print "<form><tr><input type=checkbox></tr></form>"
. "</small>";
$name = "<small>" . str_replace("\n","\n",$row["name"]) . "</small>";
$department = "<small>" . str_replace("\n","\n",$row["dept"]) . "</small>";
$email = "<small>" . str_replace("\n","\n",$row["email"]) . "</small>";
print "<TR><TD>" . $select . " </td><TD>" . $name . " </td><TD>" . $department . " </td><TD>" . $email . " </td>";
}
print "<DIV ALIGN=\"Left\">";
print "<TABLE WIDTH=100% BORDER=\"1\" CELLPADDING=\"0\" bgcolor=\"#ABDEFC\">";
print "<center><TR><TH>Select</th>";
print "<TH>Name</th>";
print "<TH>Department</th>";
print "<TH>Email</th>";;
print "</center></tr>";
if (isset($order)) {
$sorted=$order;
} else {
$sorted="name";
}
$table="employees";
$result = mysql_query("SELECT * FROM `$table` ORDER BY `$sorted`"
$nb = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$select = "<small>" . str_replace("\n","\n", print "<form><tr><input type=checkbox></tr></form>"
$name = "<small>" . str_replace("\n","\n",$row["name"]) . "</small>";
$department = "<small>" . str_replace("\n","\n",$row["dept"]) . "</small>";
$email = "<small>" . str_replace("\n","\n",$row["email"]) . "</small>";
print "<TR><TD>" . $select . " </td><TD>" . $name . " </td><TD>" . $department . " </td><TD>" . $email . " </td>";
}