Hi,
I am trying to insert two columns each from a different table into a single table and give that a value and i can only find insert INTO different table examples, and none for FROM different tables?
I have attached the table im trying to insert into: the samples, and the selection have been populated from the database. What im trying to do is for each sample and each selection (matrix) insert a value into the database using the form.
I'm thinking the problem is assigning a (sample, selection) value to each box? The column i want to save the values in the databse is called ms_conc, thats why i have assigned all the text areas the same value. Here are three lines from the form. A bit long, sorry:
<form >
<table >
<tr>
<td > </td>
<?php
$query = "SELECT site.id, sample_name
FROM site, sample, prelim
WHERE site.id = '$id'
AND sample.site_id = site.id
AND prelim.site_id = site.id
ORDER BY sample.id ASC LIMIT 5";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
extract($row);
echo "<td class=\"row2\" ><label> <span> $sample_name</span> </label></td> " ;
} ?>
</tr>
<tr>
<td ><?php
$query = "SELECT contam, gac_value FROM gac_ea WHERE land_use = '$l_euse' ORDER BY id";
$result = mysql_query($query) or die(mysql_error());
echo "<select name=contam value=''></option>";
echo "<option>Select </option>";
while($row=mysql_fetch_array($result)){
echo "<option value=$row[id]>$row[contam]</option>";}
echo "</select>"; ?></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
</tr>
<tr>
<td></tr></td>
</tr>
<tr>
<td ><?php
$query = "SELECT contam, gac_value FROM gac_ea WHERE land_use = '$l_euse' ORDER BY id";
$result = mysql_query($query) or die(mysql_error());
echo "<select name=contam value=''></option>";
echo "<option>Select </option>";
while($row=mysql_fetch_array($result)){
echo "<option value=$row[id]>$row[contam]</option>";}
echo "</select>"; ?></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
</tr>
<tr>
<td></tr></td>
</tr>
<tr>
<td ><?php
$query = "SELECT contam, gac_value FROM gac_ea WHERE land_use = '$l_euse' ORDER BY id";
$result = mysql_query($query) or die(mysql_error());
echo "<select name=contam value=''></option>";
echo "<option>Select </option>";
while($row=mysql_fetch_array($result)){
echo "<option value=$row[id]>$row[contam]</option>";}
echo "</select>"; ?></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
<td ><input type="text3" name="ms_conc" id="ms_conc" /></td>
</tr>
</table>
</form>