Multiple Values inserted into Table

From: Date: Mon, 09 Oct 2000 15:30:58 +0000
Subject: Multiple Values inserted into Table
Groups: php.general 
Request: Send a blank email to php-general+get-19201@lists.php.net to get a copy of this message
OK... I'm going nuts now I think... The page below is what I've written.... The basic idea is that the user has a form, they check off the options they want, and submit it. Those options are then put into a MySQL db. The form options are pulled from a MySQL db. I can't figure out how to insert multiple options into one field of one record in the MySQL db... I either get 1 option in one record, or I get all my options in separate records. I know why this is happening, but don't know how to correct it... can anyone help? Thanks, -Ben <html> <head> <title>Admin Area</title> </head> <body> <p align="center"><big><big>Admin Area</big></big></p> <? if ($Submit){ // Conect to DB Here $query="SELECT Task from Tasks where Category='ProjDesc'"; $result = mysql_query($query,$mysql_link); $count="0"; while ($myrow=mysql_fetch_array($result)){ $count= ($count + 1); $idea="$idea$count"; $idea="$myrow[0]"; $value="project$count"; if ($$value=="$idea") { $sql = insert into projects ('project') values ('$idea'); $result = mysql_query($sql); } } print "<BR>success"; } else{ ?> <form method="POST" action="test.php"> Project Components:<BR> <script language="php"> //Connect to DB Here $query = "SELECT Task FROM Tasks where Category='ProjDesc' "; $result = mysql_query($query, $mysql_link); $count="0";
     if(mysql_num_rows($result)) {
       // we have at least one user, so show all users as options in select form
       while($row = mysql_fetch_row($result))
       {
           $count=($count + 1);
          print("<INPUT TYPE=\"CHECKBOX\" NAME=\"project$count\" value=\"$row[0]\">$row[0]<br>");
       }
     } else {
       print("<INPUT TYPE=\"CHECKBOX\" value=\"\">No components have been entered yet<br>");
     }
</script> &nbsp; <input type="Submit" NAME="Submit" value="Submit"> </p> </center></div> </form> <? } ?> </body> </html>

« previous php.general (#19201) next »