Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ASP checked values of checkbox Array with Text Field

New Here ,
May 30, 2010 May 30, 2010

Hoping someone can help me.

I have a form with a recordset where each record has a checkbox and a text field. The user check the box and enter items in the text field. On the next page, I want to display just the records where the checkboxes are checked with the items entered in the text fields.

Problem is that in the text field, the user may separate each item with a comma, which screws everything up. Here's an example.

My Form:

<form method=post action=form-checkboxck.asp>
<input name=rma type=checkbox id="rma" value='cricket'>Bedroom<input name="accessories" type="text" id="accessories" value="desk, bed">
<input name=rma type=checkbox id="rma" value='football'>
Bathrrom<input name="accessories" type="text" id="accessories" value="vanity, medicine cabinet">
<input name=rma type=checkbox id="rma" value='tennis'>
Kitchen<input type="text" name="accessories" id="accessories">
<input name=rma type=checkbox id="rma" value='hockey'>Basement<input type="text" name="accessories" id="accessories">
<input type=submit value='Submit'>
</form>

My results.asp page:

Dim mode,mode_a,accessories, accessories_a,i
mode=Request("rma")
mode_a=split(mode,",")
accessories=Request("accessories")
accessories_a=split(accessories,",")

For i=LBound(mode_a) to UBound(mode_a)

Response.Write mode_a(i) + accessories_a(i) + "<br>"

next

Right now, the above code returns the following:

6desk
7 bed

I want it to return this:

6desk, bed
7 vanity, medicine cabinet

Any idea?

Thank you!

TOPICS
Server side applications
948
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 30, 2010 May 30, 2010
LATEST

Why are you putting the items into an array if you just want to output the string the user entered?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines