Jump to content

joelphil

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joelphil's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wildteen, thanks for your help but, it didn't insert data. I appreciate your time and help. -Joel [!--quoteo(post=387472:date=Jun 24 2006, 10:53 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 24 2006, 10:53 AM) [snapback]387472[/snapback][/div][div class=\'quotemain\'][!--quotec--] Something like this: [code]<?php if(isset($_POST['submit'])) {     for($i = 0; $i <= 3; $i++)     {         $choice[$i] = isset($_POST['choice'][$i]) ? $_POST['choice'][$i] : 'NULL';     }     $sql = "INSERT INTO tbl_name (choice1, choice2, choice3, choice4) VALUES ('" . implode("', '", $choice) . "')";#     echo "Query built: <code>" . $sql . '</code><br /><br />'; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="post"> <INPUT type=checkbox name="choice[0]" value="one">One <INPUT type=checkbox name="choice[1]" value="two">Two <INPUT type=checkbox name="choice[2]" value="three">Three <INPUT type=checkbox name="choice[3]" value="four">Four <INPUT type=submit name=submit value="Submit">[/code] Probably a long route but it does what you want to do. [/quote]
  2. hello all, my goal has been to insert data into mysql using a form with checkboxes: Here's my basic form: <form action="POST" METHOD="insertdata.php"> <INPUT type=checkbox name="choice[]" value="one">One <INPUT type=checkbox name="choice[]" value="two">Two <INPUT type=checkbox name="choice[]" value="three">Three <INPUT type=checkbox name="choice[]" value="four">Four <INPUT type=submit name=submit value="Submit"> Here is basic table for info" $sql = Insert into tbl_name (choice1,choice2, choice3, choice4) VALUES (... you get the picture. so, I have tried counting array and using foreach but, I am unable to resolve this problem. any help would be great. thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.