Jump to content

User input during display


frenchpl

Recommended Posts

I have a table display of eleven columns and multiple rows.

I have no problem populating the table or displaying it.

I now want one of the eleven columns to be an input column.

Such that the user can 'check' this column, for any row of

the displayed table.

If I am displaying ten rows at a time from the DB, I need the

user to be able to 'check' any number from one to all ten, before

hitting the submit button and the values being recorded.

Any suggestions please?

Link to comment
https://forums.phpfreaks.com/topic/197351-user-input-during-display/
Share on other sites

when outputting a record's data in the table, include a line to output the HTML to create the checkbox.

while ($rowData = mysql_fetch_assoc($result))
{
   foreach($rowData as $fieldName => $value)
   {
      print($value); // etc outputting your record data
   }
   print('<input type="checkbox" name="'.$rowData['idNum'].'"/><br/>'); // $rowData['idNum'] is an example of the record's primary key value
}

when outputting a record's data in the table, include a line to output the HTML to create the checkbox.

while ($rowData = mysql_fetch_assoc($result))
{
   foreach($rowData as $fieldName => $value)
   {
      print($value); // etc outputting your record data
   }
   print('<input type="checkbox" name="'.$rowData['idNum'].'"/><br/>'); // $rowData['idNum'] is an example of the record's primary key value
}

 

When $result is your mysql query to get the data.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.