I have a checkbox group in an HTML form that I want to use to 
populate a MySQL set.  The data seems to come into the php 
array correctly, because when I do a test print loop the proper 
values are displayed, but the data from $misc is not present 
for the record in the MySQL database.  How do I insert data 
into a set?

HTML:
<form name="fExample" method="post" action="example.php">
  <table width="330" border="0">
    <tr>
      <td width="110">
        <input type="checkbox" name="misc[]" value="a"> a </td>
      <td width="110">
        <input type="checkbox" name="misc[]" value="b"> b </td>
      <td width="110">
        <input type="checkbox" name="misc[]" value="c"> c </td>
    </tr>
  </table>

PHP:
        for ($z = 0; $z < count($misc); ++$z)
        {
                print "$misc[$z]<BR>";
        }

        $queryInsert = "INSERT INTO studentInfo (lName, fName, misc)
                                                VALUES ('$lName', '$fName', '$misc')";
        mysql_query($queryInsert, $link);


MySQL Table:
CREATE TABLE example
(
        lName VARCHAR(20) NOT NULL,
        fName VARCHAR(20) NOT NULL,
        misc SET('a','b','c'),
        form_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
);

===========================================================
Kenneth E. Lemons                       Information Technology Office
Computer Systems Engineer       School of Engineering
[EMAIL PROTECTED]            and Applied Sciences
804-924-3705                    University of Virginia

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to