Jump to content

Generate List


phpnewbie81

Recommended Posts

hi all,

 

Im a php newbie here.

Now i want to have function called 'GenerateList' to generate a list table where the first column is a check box (to let users multiselect the record), and the rest of the colums are the field from the table. Any guide / any example for that ?

Link to comment
Share on other sites

<?php
$fields = Array("Field1", "Field2", "Field3");
$values = Array(Array(5,4,3,2,1), Array(1,3,2,4,5), Array(1,2,3,4,5));
echo "<form action='processForm.php' method='post'>";
echo "<table><tr><td><b>Selected</b></td><td><b>Field1</b></td><td><b>Field2";
echo "</b></td><td><b>Field3</b></td></tr>";
for($i=0;$i<count($fields);$i++) {
  echo "<tr><td><input type='checkbox' name='check$i'></td><td>";
  echo $values[0][$i]."</td><td>".$values[1][$i]."</td><td>";
  echo $values[2][$i]."</td></tr>";
}
echo "</table></form>";
?>

Is that what you have in mind? Hope it helps.

(AAACK! it looks more like a matrix than I'm comfortable with! ;D)

Link to comment
Share on other sites

Just modify what Tom has given you to your needs - if you need more than that then be specific in your requirements.

 

If you ar looking to make this an object then say so.

 

Bottom line if you just ask for a table to list checkboxes - that is what you get... nothing more.

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.