Question : Send multiple checkbox to a contact page

i have a page with a list of documents obtained from a mysql query. This list provides a checkbox (value=id of document) per document, and, what i need is to create a button that send the selected document id's (one checkbox correspond to 1 id) to a new page (a contact form page) that will contain a textbox (textarea) with the selected items concatenated in it.

For example,

- supose the list has 7 documents (so 7 id's)
- supose we selected 4 documents (4 checkboxes from those 7)
- after clicking on a "Submit" button the result should be going to the next page and displaying a textbox (in a contact page) with the concatenated "http://localhost/open/id_number" string.

I currently have achieved displaying the documents in the list and add the checkbox asociated to its id_number in it.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
print("<h2>Listing $count documents</h2></td>\n");
	print("<table id=\"files_list\">");
	print("<tr>\n");
	//printf("<th></th>\n");
	printf("<th><a href=\"list.php?order=%s\">Sel.</a></th>\n", ($order == "id DESC" ) ? "id%20ASC" : "id%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Tipo</a></th>\n", ($order == "type DESC" ) ? "type%20ASC" : "type%20DESC" );
	//printf("<th><a href=\"list.php?order=%s\">Filename</a></th>\n", ($order == "name DESC" ) ? "name%20ASC" : "name%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Documento</a></th>\n", ($order == "name DESC" ) ? "name%20ASC" : "name%20DESC" );
	//printf("<th><a href=\"list.php?order=%s\">Size</a></th>\n", ($order == "size DESC" ) ? "size%20ASC" : "size%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Tamaño</a></th>\n", ($order == "size DESC" ) ? "size%20ASC" : "size%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Rev</a></th>\n", ($order == "revision DESC" ) ? "revision%20ASC" : "revision%20DESC" );
	//printf("<th><a href=\"list.php?order=%s\">Author</a></th>\n", ($order == "author DESC" ) ? "author%20ASC" : "author%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Autor</a></th>\n", ($order == "author DESC" ) ? "author%20ASC" : "author%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Maintainer</a></th>\n", ($order == "maintainer DESC" ) ? "maintainer%20ASC" : "maintainer%20DESC" );
	//printf("<th><a href=\"list.php?order=%s\">Created</a></th>\n", ($order == "cdate DESC" ) ? "cdate%20ASC" : "cdate%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Fecha de Creación</a></th>\n", ($order == "cdate DESC" ) ? "cdate%20ASC" : "cdate%20DESC" );
	//printf("<th><a href=\"list.php?order=%s\">Modified</a></th>\n", ($order == "mdate DESC" ) ? "mdate%20ASC" : "mdate%20DESC" );
	printf("<th><a href=\"list.php?order=%s\">Ultima Modificación</a></th>\n", ($order == "mdate DESC" ) ? "mdate%20ASC" : "mdate%20DESC" );
	printf("<th></th>\n");
	print("</tr>\n");

    while($row = @mysql_fetch_array($res)) {
      print("<tr>\n");
	  print ("<td><input type='checkbox' value='$row[id]'></td>\n");
	  //print("<td>$row[id]</td>\n"); //prueba exitosa de id por Oscar
      print("<td><a href=\"download.php?doc_id=$row[id]\"><img src=\"pix/". get_extension($row[name]) .".gif\" height=\"16\" width=\"16\" alt=\"[". strtoupper(get_extension($row[name])) ."]\" border=\"0\"></a></td>\n");
      print("<td><a href=\"detail.php?doc_id=$row[id]\">$row[name]</a></td>\n");
      if($row[size] < 0)
          continue;
      if( $row[size] < 10240 ) {
          $size_str = sprintf("%d bytes", $row[size]);
      } else if( $row[size] < 1048576 ) {
          $size_str = sprintf("%.1f Kb", ($row[size]/1024));
      } else {
          $size_str = sprintf("%.1f Mb", ($row[size])/(1024*1024));
      }
      print("<td>$size_str</td>\n");
      print("<td>$row[revision]</td>\n");
      print("<td>$row[author]</td>\n");
      print("<td>$row[maintainer]</td>\n");
      print("<td>$row[created]</td>\n");
      printf("<td%s</td>\n", ($row[modified] == NULL) ? " align=\"center\">-" : ">$row[modified]" );
      printf("<td><img src=\"pix/%s.gif\" height=\"15\" width=\"15\" alt=\"[ Access: %s ]\"></td>\n", ($row[level] == NULL) ? "G" : $row[level], access_string( ($row[level] == NULL) ? "G" : $row[level] ) );
      print("</tr>\n");
    }
  }

Answer : Send multiple checkbox to a contact page

You are sending the form data to a file called send.php when you click on the submit button.

In the send.php file you can create the delimited string for the check ID's with the code I posted earlier.

<?php
if (isset($_POST['DocID'])) {
   $SelectedDocuments = implode(",", $_POST['DocID']);
}
?>


In the send.php script you now have a variable called $SelectedDocuments.

To put that in the textarea, you will need to echo it into the form. Take a look at the code below to see what I mean.


1:
<td><textarea name="detail" cols="50" rows="4" id="detail"><?=$SelectedDocuments?></textarea></td>
Random Solutions  
 
programming4us programming4us