467,871 Members | 1,452 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,871 developers. It's quick & easy.

Inserting checkbox values into text field

Hi

Was wondering if anyone could help me with this problem :

If I have three checkboxes with different values on a form like :

<input type="checkbox" name="checkbox" value="1stValue">
<input type="checkbox" name="checkbox" value="2ndValue">
<input type="checkbox" name="checkbox" value="3rdValue">

And I needed to submit that form so that the values end up in a text field
called CHECKBOX_TERMS with an AND in between each, so that the text field
on the same form has in effect '1stValue AND 2ndValue AND 3rdValue'
contained within it.

Which is the best way to do it ?

Thanks

JT


Sep 8 '06 #1
  • viewed: 1957
Share:
1 Reply
J Talbot wrote:
If I have three checkboxes with different values on a form like :
<input type="checkbox" name="checkbox" value="1stValue">
<input type="checkbox" name="checkbox" value="2ndValue">
<input type="checkbox" name="checkbox" value="3rdValue">
And I needed to submit that form so that the values end up in a text field
called CHECKBOX_TERMS with an AND in between each, so that the text field
on the same form has in effect '1stValue AND 2ndValue AND 3rdValue'
contained within it.

Which is the best way to do it ?
To change the server side script.

Something along the lines of:

my $CHECKBOX_TERMS;
my $sep = "";
foreach my $checkbox ($cgi->param('checkbox')) {
$CHECKBOX_TERMS .= $sep . $checkbox;
$sep = " AND ";
}

Sep 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Yama | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.