How do I change the query below so that MANU_ID which comes from the Manufacturers table is inserted into the Models table.

$sql="INSERT INTO Models(MOD_Name)
 VALUES
  ('$_POST[model]')";

Any help would be greatly appreciated thanks

I'd have to see the table structures to be specific but to insert from another table you do

INSERT INTO table1 (FName, LName)
    SELECT FirstName, LastName
      FROM table2

With this type of query, the SELECT statment replaces the VALUES statement. You can use all the usual parameters for the SELECT such as WHERE, BETWEEN, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.