Database and check boxes

Results 1 to 3 of 3

Thread: Database and check boxes

  1. #1
    Brandon Winn Guest

    Default Database and check boxes

    I am building a database which has a field that contains multiple items (the information is beign entered via checkboxes in a form - the checkboxes are all named with the same group name and have different values). Then, when i want to edit/update this info, and bring up the boxes that were checked, i am having trouble getting the check boxes to come up checked - i can do it with only one value in the database field. For example, if the field is called FavoriteColors and the user selects the boxes: Red, Blue, and Green and then after they submit their favorite colors they want to modify the info so they go to update their profile, how do i get the appropriate check boxes to be checked? Is there a way to do an IF Then statement filtering out the key word Blue for the Blue box to be checked?<BR><BR>Sorry if this sounds confusing...Thanks for anyones help!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Database and check boxes

    Hi,<BR>this is what i have understood.<BR>u have a form with no of checkboxes with same name but diff value. when u submit form...checkboxes values get stored in database.<BR><BR>Now when user comes back for modification...user shld see earlier check boxes checked. if this is ur prob .. i may have the solution.<BR><BR>Try somethin like this.<BR><BR>&#060;Input type="checkbox" name="color" value=*from databse* <BR>&#060;% if *check if there is value in database for this checkbox* then %&#062;<BR>CHECKED<BR>&#060;% end if %&#062;<BR>&#062;<BR><BR>U can repeat it for all ur checkboxes.<BR><BR>Hope it helps u<BR>ks.<BR>

  3. #3
    Brandon Winn Guest

    Default RE: Database and check boxes

    I could not get it to work... i am not sure if i did it correctly (I am new at this!!!) Here is what i have been using for those checkboxes which only have one value rather than multiple values:<BR>&#060;input type="checkbox" name="Trades" value="Plastering"&#060;%if rs("Trades") = "Plastering" Then%&#062;checked&#060;%Else%&#062; &#060;%End If%&#062;&#062;Plastering<BR><BR>I have been playing with the if then statement and cant seem to get anything to work...When i used your suggestion i got a syntax error back... Basically i am looking to see(in laymen terms) IF the Selected field in the database contains a string of text THEN Check the box. Any further advice is surely appreciated! Thanks for you help!!<BR><BR>Brandon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts