Forum Moderators: coopster

Message Too Old, No Replies

Multiple checkbox to a textbox

Multiple checkbox to a textbox

         

oscargarin

2:07 pm on Aug 18, 2010 (gmt 0)

10+ Year Member



"Hola",

i have the following issue and i'd be very happy if someone can help.

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 send only the selected document id's( one checkbox correspond to 1 id) to a new form (it is a contact form) that will contain a textbox 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 would really appreciatte any help on any part of this.

I currently have achieved displaying the documents in the list and add the checkbox asociated to its id_number in it.

Can somebody please help?

The following code represent the checkbox id_number for every document. It is working already.



input type='checkbox' value='$row[id]'

Matthew1980

2:44 pm on Aug 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there oscargarin,

First of all welcome to WebmasterWorld :[webmasterworld.com ]

Could you post the code relevant to your question, so that we can better advise you.

Cheers,
MRb

oscargarin

3:26 pm on Aug 18, 2010 (gmt 0)

10+ Year Member




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");
}
}

oscargarin

4:37 pm on Aug 19, 2010 (gmt 0)

10+ Year Member



what the above code does is to create an htm page with the list of documents displaying their attributes:
doc_id/extension/doc name/size/revision/author/creation date/

those are the properties of all documents listed. each document has a checkbox asociated to its document_id.

what i need is to select different checkboxes get their ids copied to a textbox, textarea or even a clipboard.