Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check box Form and Passing Multiple Values as An Array

Status
Not open for further replies.

weldonj

Programmer
Jul 8, 2000
3
US
All right I'm new to this, but thought I had this figured out last night, but now am stuck.<br><br>I have a form.&nbsp;&nbsp;I have multiple checkboxes and I am going to make users check 3 of them.&nbsp;&nbsp;I want to eventually put these three valeus into three different variables.&nbsp;&nbsp;So i figured i'd store them as an array and then take the values from the array.<br><br>I did this fine yesteday with one of those option value boxes.&nbsp;&nbsp;Some sample coder here: <br>&nbsp;&nbsp;&lt;SELECT NAME=&quot;myarray[]&quot; MULTIPLE SIZE=&quot;5&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION VALUE=&quot;test&quot;&gt;test&lt;/OPTION&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION VALUE=&quot;test2&quot;&gt;test2&lt;/OPTION&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION VALUE=&quot;test3&quot;&gt;test3&lt;/OPTION&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;etc...<br><br>The values checked were stored in the array myarray[], and I could subsequently count the values to make sure 3 were checked and then pull out the values one by one.<br><br>However, I'm having trouble doing this with a checkbox.&nbsp;&nbsp;Here's my code:<br>&nbsp;&lt;input type=&quot;checkbox&quot; name=&quot;myarray[]&quot; value=&quot;test&quot;&gt;<br>&nbsp;&lt;input type=&quot;checkbox&quot; name=&quot;myarray[]&quot; value=&quot;test2&quot;&gt;<br>&nbsp;&lt;input type=&quot;checkbox&quot; name=&quot;myarray[]&quot; value=&quot;test3&quot;&gt;<br>&nbsp;&lt;input type=&quot;checkbox&quot; name=&quot;myarray[]&quot; value=&quot;test4&quot;&gt;<br><br>It seems to only be storing one of the values checked into the array.&nbsp;&nbsp;Any help with this would be appreciated.<br><br>Thanks
 
Ignore the last post.&nbsp;&nbsp;I put what I wrote into my form and it worked.&nbsp;&nbsp;I must have screwed up the syntax I was using somehow.&nbsp;&nbsp;Sorry.<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top