Jump to content

updating table through checkbox/radio and form submit


diffenc

Recommended Posts

It's been four years since I had to program PHP, so help I need!

 

I'm needing to pull some information out of a database table, check to see if it's acceptable, manually flag it one way or another, and write to another database field a 1 or a 0 to indicate it has been reviewed and approved/denied.

 

I've got my database set up, but I'm not knowing the best way to mark the stuff and push it back in as cleared.

 

Using while($row = mysql_fetch_array($box1dist)) to get the results from my initial query and write them into an HTML table. I need, next to each result, a checkbox for yes and a checkbox for no to manually select and submit back into the database.

 

echo "<form id=\"form1approval\" name=\"form1approval\" method=\"post\" action=\"runapproval.php\" ><table border='1'>
<tr>
<th>Box one result (";
echo $box1count;
echo ")</th>
<th>Approved?</th>
</tr>";
while($row = mysql_fetch_array($box1dist))
  {
  echo "<tr>";
  echo "<td>" . $row['box1t'] . "</td>";
  echo "<td>Correct <input type=\"checkbox\" id=\"yes\" name=\"yes\" \/> Error <input type=\"checkbox\" id=\"no\" name=\"no\" \/> </td>";
  echo "</tr>";
  }
echo "</table><input type=\"submit\" name=\"submit\" value=\"submit\" \/></form>";

 

Help is much appreciated!

Link to comment
Share on other sites

From your description, just output the rows in a table format, on the field that you want to display the status, lets call it approved

 

id  |  name  |  approved

1  |  John  |  no

2  | Fred    | yes

 

Then display the row, make the no and yes a URL so when you click on it, it changes from no to yes or yes to no ?

Link to comment
Share on other sites

I'm actually going to run a filter first to see if the column for approval is NULL or not, and only return results back if it is NULL to be sorted.  Once I flag a particular string as approved/disapproved and write it to that column, I'm comparing all new results to the approved/disapproved set.

 

I basically am listing all unique column entries from the table that have not already been looked at, and need to push back a flag to the table saying it's been sorted and approved/not.

Link to comment
Share on other sites

Yes, the review field exists (two actually, as I have to run this on two columns of entries)

 

I am running a usability test on some forms going out to a reasonable amount of people.  I'm giving them information and asking them to populate a series of forms to find out where they are putting bits of data to submit.  I am then stripping punctuation, converting them to lowercase, and writing it to the db in a new column. 

 

Next, I'm selecting all the unique strings from that column for this approval check through an HTML page my tester will use.  Once a string is marked approved/unapproved and sent back to the table, that string never needs checking again.

Link to comment
Share on other sites

maybe this will help

 

http://chipdiffendaffer.com/formtesting/translate.php

 

this shows the result of my initial query.  Each result is placed in a row.  For every listing, if the user clicks "Correct" and submit, I want to write a 1 to the awaiting column in the database.  If "Error" is checked, I want to write a 0.  If "Delete" is checked, I want to delete that row altogether. 

 

If nothing is checked, the value remains NULL and will be available to flag later.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.