checkbox answers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • testingkp
    New Member
    • Sep 2014
    • 2

    checkbox answers

    hya i have added a select box group for my members interests in the line of something like


    item1
    item2
    item3
    item4

    and if someone was to tick 2, 3 and 4 i want all 3 selections to show in database where as at the moment only the last one selected is showing in table

    ive wrapped the name in [] as said in other posts but when i check selection in database all i get is array after submitting form again

    what can i do to achieve this ty in advance kevin
  • mukherjee
    New Member
    • Sep 2014
    • 9

    #2
    You need to add multiple records in database or save the choices in colon separated form like(item1:item 2) ,etc.

    Comment

    • testingkp
      New Member
      • Sep 2014
      • 2

      #3
      i am lost just gone into database went to change multiple_intere sts table by attempting to change it to userdefined and add options to choose and i get query error msg here the coding that i have so far

      Code:
      $insert = mysql_query("update user_info set postalcode = '".$_POST['postalcode']."' , 
      	city 			= '".$_POST['city']."' , 
      	seeking 		= '".$_POST['seeking']."' , 
      	height 			= '".$_POST['height']."' , 
      	lookingfor 		= '".$_POST['lookingfor']."' , 
      	hair 			= '".$_POST['hair']."' , 
      	bodytype 		= '".$_POST['bodytype']."' , 
      	havecar 		= '".$_POST['owncar']."' , 
      	education 		= '".$_POST['education']."' , 
      	eyecolor 		= '".$_POST['eyecolor']."' , 
      	union_territory = '".$unionterritory."' , 
      	smoke 			= '".$_POST['dosmoke']."' , 
      	drink 			= '".$_POST['dodrink']."' , 
      	wantdate_smokes = '".$_POST['datesmokers']."' , 
      	talking_about 	= '".$talk_about."' , 
      	multiple_Interests = '".$_POST['multiple_Interests']."' , 
      	headline 		= '".$headline."' where user_id = '".$_SESSION['last_id']."' ") or die(mysql_error());
      Code:
      <tr>
          <td><input name="multiple_Interests" type="checkbox" value="option1" /><label for="option1">option1</label></td>
          <td><input name="multiple_Interests" type="checkbox" value="option2" /><label for="option2">option2</label></td>
          <td><input name="multiple_Interests" type="checkbox"value="option3" /><label for="option3">option3</td>
        </tr>

      Comment

      Working...