Could anyone help me figure out how to get the array data properly into a database? My data array is going to vary and I cannot see a way to get past this issue. I have included the code - could anyone please help?
<?php
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">";
//get db config info
require $_SERVER['DOCUMENT_ROOT'].".\config\db_config.php";
//Makes connection to db or displays custom error page.
$connection = mysql_connect($db_host, $db_user, $db_password)
or die(mysql_error());
//pick db to use
$result=mysql_select_db($db_name, $connection)
or die("Database connection failed!");
//set table to use
$tablename1="utak_product_main";
$tablename3="utak_product_analyte";
?>
<html>
<head>
<title>UTAK P2P - Add Analysis: Part Two</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?
$select1 = $POST['prod_id'];
$select2 = $POST['prod_lot_no'];
$query = "SELECT prod_analyte FROM $tablename3 WHERE prod_id='$select1'";
$result3 = mysql_query($query) or die(mysql_error());
?>
<form action="utak_p2p_add_new_c.php" method="POST">
<br>
<font face="Arial" size="2" color="black"><b>Test Name:</b></font> <input type="text" name="txt_name" size="50"><p>
<? // This is the data array for the product and product lot from part one of adding a new test
echo('
<b><font face="Arial" size="2" color="black">Product Number:</b></font>  '.$select1.'
<br>
<b><font face="Arial" size="2" color="black">Product Lot Number:</b></font>  '.$select2.'
<p>
');
{
$printOut = "<table height=-200 border=1>";
while($row = mysql_fetch_array($result3)) {
$theLabel = strtr($row["prod_analyte"], " ","");
if (!empty($theLabel)) {
$printOut.="<tr><td><b><font face='Arial' size='2' color='black'>".$row["prod_analyte"]."</b></font></td>
<td><input type=\"text\" value=\"0\" name=\"".$rows["prod_analyte"]."\"></td></tr>";
}
}
if (!stristr($printOut,"<tr>")) {
$printOut.="<tr><td><b><font face='Arial' size='2' color='black'>Results:</b></font></td>
<td><input type=\"text\" value=\"0\" name=\"txt_result\"></td></tr>";
}
$printOut.="</table>";
echo($printOut);
}
?>
<p><b><font face="Arial" size="2" color="black">Test Comments:</b></font><br>
<textarea style="width: 100%" rows="10" name="txt_analysis"></textarea>
<input type="submit" value="Submit Data">
<input type="reset" value="Reset Data">
 
<input type="button" value="GoBack" onclick="history.go(-1)">
</form>