Quick issue:
I have a checkbox in my code that tells the user if the status of a record is DONE or NOT DONE. When the user does a records search in the database, the records that show up, show up with the current record status (DONE or NOT DONE).
If the checkbox is not check means that the record is NOT DONE, so I'm trying to place a checkbox on one side of the record status so the user can check it as soon as they are done working on the record. After they check the checkbox, the value is sent to the DB telling the DB that the new status of the record is DONE
How can I accomplish this when the following example code: (The results are shown after the user made a search using a form)
<?php
if(!isset($_POST['search']))
{
?>
<?php
}
else
{
$from = trim($_POST['OLD']);
$to = trim($_POST['NEW']);
$status = isset($_POST['Status']) ? "AND status = 'DONE' " :"AND status = 'NOT DONE' ";
$connection = mysql_pconnect("HOST", "USER", "PASS") or die("Connection failed. ".myslq_error());
mysql_select_db("DBNAME") or die("Unable to select db. ".mysql_error());
$query = "SELECT * FROM records WHERE Date >= '$from' AND Date <= '$to' ".$status." ORDER BY date ASC";
$result = mysql_query($query) or die(mysql_error());
echo "<table class='table' id='SearchResult' cellspacing='0' cellpadding='0'>";
echo "<tr class='rowa'><b>";
echo "<td class='col0 cell'>ID</td>";
echo "<td class='col1 cell'>Name</td>";
echo "<td class='col2 cell'>Last Name</td>";
echo "<td class='col3 cell'>Place</td>";
echo "<td class='col4 cell'>Station</td>";
echo "<td class='col5 cell'>Phone</td>";
echo "<td class='col6 cell'>Date of Record</td>";
echo "<td class='col7 cell'>Status</td>";
echo "</tr>";
echo "</table>";
while($record = mysql_fetch_object($result))
{
echo "<table class='table' id='SearchResult' cellspacing='0' cellpadding='0'>";
echo "<tr class='rowb'>";
echo "<td class='col0 cell'>".$record->ID."</td>";
echo "<td class='col1 cell'>".$record->Name."</td>";
echo "<td class='col2 cell'>".$record->lastName."</td>";
echo "<td class='col3 cell'>".$record->Place."</td>";
echo "<td class='col4 cell'>".$record->Station."</td>";
echo "<td class='col5 cell'>".$record->Phone."</td>";
$year_part_of_date = explode('-', $record->date);
echo "<td class='col6 cell'>".$record->date."</td>";
echo "<td class='col7 cell'>".$record->Status."</td>";
echo "</tr>";
echo "</table>";
}
}
?>
Thanks everyone for showing me the way :D