I have looked thoroughly, but I have not found the solution (or perhaps I didn’t realize I had since I’m a novice)… Here is my problem:
My table has these six fields: username,want1,want2,want3,want4,want5. My form has username, and a multiple SELECT box where five wishes are selected. I want to insert that username and those selections together as a record, in their corresponding “cell” in the table. Here is my code (for the submit/$_POST action) so far:
*Note: I have named the multiple SELECT box “wants[]” so that it knows it’s an array.
<?php
//variables
$username = $_POST['username'];
$want = $_POST['wants'];
//connect
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
//insert
mysql_query("INSERT INTO The_Table (username,want1,want2,want3,want4,want5) VALUES ('$username','$want[0]','$want[1]','$want[2]','$want[3]','$want[4]')");
?>
When I test, no bugs/errors show, but the table isn’t being filled with a record. I am very new to coding, I apologize. Hopefully there is a simple solution. Thank you so much to any help or advice!!
Try this code i hope its work for you…