Alright, let me start by saying that I know zero PHP or SQL code, myself. I have a SQL guy creating tables, and I've been using what I've found on W3C Schools. So far it's been ok, but I have a problem I need solved.

I have created an HTML table that displays the content of a SQL table (thank you W3C). One of the fields in the table displays whether or not a person is approved. In the SQL table, this is shown with either a 1 or a 0, of course. I need a checkbox that the client can select and then write back to the table either 1 (approved) or 0 (denied), and then submit. If the time card is approved, I need it to show up in another table that is yet to be created. If the time card is denied, I need an email to be sent to the contractor with client notes, so that the time card can be adjusted accordingly.

Right now, the code looks like this:

echo "<table id='timecards'>
     <tr>
          <td align='center'>ID</td>
	  <td align='center'>Date</td>
	  <td>Notes</td>
	  <td align='center'>Hours</td>
	  <td align='center'>Approved</td>
     </tr>";

     while($row = mysql_fetch_array($result))
     {
     echo "<tr>";
     echo "<td align='center'>" . $row['ContractorID'] . "</td>";
     echo "<td align='center'>" . $row['JobTimecardDate'] . "</td>";
     echo "<td align='left'>" . $row['JobProgressNotes'] . "</td>";
     echo "<td align='center'>" . $row['JobHoursToBill'] . "</td>";
     echo "<td align='center'>" . $row['JobHoursApproved'] . "</td>";
     echo "</tr>";
     }
     echo "</table>";

"JobHoursApporoved" is the cell in question.

I realize that this is kind of a large request, but any help would be massively appreciated. Thank you so much.

Member Avatar for diafol

Yep, a bit large. Perhaps just asking one thing would be more appropriate especially for your first post. You state that you know zero php/sql as if that's a reason/excuse ... If you need help, start helping yourself and post any code that you produce which perhaps does't quite work. This isn't a rent-a-sap forum, although doubtless you'll get some over-enthusiastic noob trying to show off.

So, take some time to learn the language and be prepared to make mistakes. Free lunches are off the menu.

Thank you for the response. I'm not looking for someone to do the work for me. I'm just on a deadline for this project and if anyone could point me towards a tutorial of some sort that is relevant to what I'm doing, that would be great. Even just the checkbox item. I just don't know what to search for and if someone who is more experienced could point me in the right direction, that would be helpful.

I found some code that I guess will do what I need, but I'm not sure about the syntax.

This is what I found:

<form action="checkbox-form.php" method="post">
    <input type="checkbox" name="JobHoursApproved" value="Yes" />
</form>

and

<?php
if(isset($_POST['JobHoursApproved']) &&
   $_POST['JobHoursApproved'] == 'Yes')
?>

I need it to go into the "JobHoursApproved" cell in my code above. Ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.