Are you sure you really want to store the value and NOT the ID? That's sort of the point of why you have a relational database - so you can define a value (or values) in one place and reference that values in others without having to duplicate the data.
Looking at the code in your first post I don't see why it would be saving the ID as opposed to the value (unless the values in that table are the same as the IDs). But, that code is very inefficient.You should NEVER run queries in loops. If you do store the IDs (as I think you should) you can create ALL the records with just ONE query. But, if you do need to store the values then you can at least replace those four queries in the loop with a single query.
foreach($_POST['fields'] as $items)
{
//Process values for DB use
$name = mysql_real_escape_string($_POST['name']);
$number = mysql_real_escape_string($_POST['number']);
$address = mysql_real_escape_string($_POST['address']);
$other = mysql_real_escape_string($items['other']);
$hardwareid = mysql_real_escape_string($items['hardwareid']);
$replacement = mysql_real_escape_string($items['replacement']);
$hardwarerep = mysql_real_escape_string($items['hardwarerep']);
$caseID = intval($items['case']);
$hmodelID = intval($items['hmodel']);
$errorID = intval($items['error']);
$query = "INSERT INTO `customer_data`
(`name`, `number`, `address`, `other`, `hardwareid`, `replacement`, `hardwarerep`, `case`, `hmodel`, `error`)
SELECT '$name', '$number', '$address', '$other', '$hardwareid', '$replacement', '$hardwarerep',
(SELECT value FROM fields WHERE id='{$caseID}' LIMIT 1),
(SELECT value FROM fields WHERE id='{$hmodelID}' LIMIT 1),
(SELECT value FROM fields WHERE id='{$errorID}' LIMIT 1)"
$result = mysql_query($query) or die(mysql_error());
echo "<br> Din registrering har ID : ".mysql_insert_id();
}But, if you do only store the IDs (as I think you should) then you only need to create one query by looping over the records. It will be much, much more efficient. Something like this
$values = array();
foreach($_POST['fields'] as $items)
{
//Process values for DB use
$name = mysql_real_escape_string($_POST['name']);
$number = mysql_real_escape_string($_POST['number']);
$address = mysql_real_escape_string($_POST['address']);
$other = mysql_real_escape_string($items['other']);
$hardwareid = mysql_real_escape_string($items['hardwareid']);
$replacement = mysql_real_escape_string($items['replacement']);
$hardwarerep = mysql_real_escape_string($items['hardwarerep']);
$caseID = intval($items['case']);
$hmodelID = intval($items['hmodel']);
$errorID = intval($items['error']);
$values[] = "('$name', '$number', '$address', '$other', '$hardwareid', '$replacement', '$hardwarerep', '$caseID', '$hmodelID', '$errorID')";
}
//Create and execute ONE query
$query = "INSERT INTO `customer_data`
(`name`, `number`, `address`, `other`, `hardwareid`, `replacement`, `hardwarerep`, `case`, `hmodel`, `error`)
VALUES " . implode(', ', $values);
$result = mysql_query($query) or die(mysql_error());