I am trying to submit my data on a php created form to mysql database where it is separate by 2 tables (device) and (location).
As some of the devices shared the same location, 2 tables are created as below.
For location table, i had created 2 fields: ID as (primary key) and area.
For device, i created 3 fields: ID (primary key), device_num and device_loc.
Using php, i created a form where user will enter the device number and the location.
The problem is i can insert the device number to my device table in mysql database and i have no idea how to link up the location table to my device table. Appreciated if some help of advise is given to me.
Below are the simple code of the insertion of my device table.
$val_d = $_POST['Device_num']; //value submit from user $val_l = $_POST['location_area']; //value submit from user $dev_insert = "INSERT INTO device (device_id, device_num) VALUES (NULL, '$val_d')"; $results = mysql_query($dev_insert) or die (mysql_error());