Hello, I have 3 databases, one with names of people I know, another one with names of tools I own and another one for "events" that involve those people and those tools. I'm using forms (drop list) to put it all together. Right now I'm having trouble with the "events" part. I have a form where I choose a person and a tool and then I want it to send that info to the "events" database. Everything seems to work fine, I don't get any errors but the info is not printed on the site. I was wondering if someone could analyze my code and help me out. Thanks in advance. Here's the form code: <form action="add_event.php" method="post"> <?php include("config.php"); $sql_tools = "SELECT * FROM list_tools"; $sql_people = "SELECT * FROM list_people"; $result_tools = mysql_query($sql_tools); $result_people = mysql_query($sql_people); $endselect = "</SELECT>"; $select_tools = "<SELECT name=\"list_tools\">"; $select_people = "<SELECT name=\"lista_people\">"; echo ("".$select_tools.""); $submit = "<BR><input type=\"submit\" value=\"Add Event\" style=\" color: #fff; font-weight:bold; background-color:#000000; border: 2px solid #fff; padding: 2px 5px; font-family: Arial, ..., serif; font-size: 11px; height: 30px; display: block; width: 350px;\">"; while ($row_tools = mysql_fetch_array($result_tools)) { $option_tools = "<option value=\"".$row_tools[toolsid]."\" />".$row_tools[toolsname].""; echo ("".$option_tools.""); } echo ("".$endselect.""); echo ("".$select_people.""); while ($row_people = mysql_fetch_array($result_people)) { $option_people = "<option value=\"".$row_people[peopleid]."\" />".$row_people[peoplename].""; echo ("".$option_people.""); } echo ("".$endselect."".$submit.""); ?> </form> PHP: And here's the code that inserts those 2 values in the "events" database: <?php include("config.php"); $result = mysql_query("INSERT INTO events (tools, people) VALUES ('".$_POST['toolsid']."', '".$_POST['peopleid']."')",$connect) or die("Could not insert data because ".mysql_error()); echo "<meta http-equiv=Refresh content=1;url=index.php>"; ?> PHP:
It looks like you're trying to insert a value that doesn't exist? I think those two items should match name='foo' and insert $_POST['foo']