What I'm trying to do with the code below is as follows: I've already selected info
from an access dbase and I am displaying it on the web page. I want the user to be able
to change the status via a drop down list, hense the SELECT part. When the status is
changed and the form.submit is executed, the value I changed to is put back to the original
value which I don't want to happen.
I know I could take out the form.submit bit but depending on the status (eg. (L) Lost) I
want another drop down list to dynamically appear next to the status with the reasons in.
I haven't coded that yet, one thing at a time at the moment.
Am I on the right track? Could I do something else in the onChange part? My aim is to
insert this info into a temp table (HitlistTemp) for future use.
I'm fairly new to web development and php so be gentle.
PHP Code:$count = 0;
$i = 0;
while ( odbc_fetch_into($result, $row) != False )
{
$count++;
if (!IsSet($Status[$i]) || ($Status[$i] <> "N" || $Status[$i] <> "L" || $Status[$i] <> "O" || $Status[$i] <> "T") )
$Status[$i] = $row[5];
echo "<TR bgcolor=$Col>\n";
echo "<TD><A href=\"fd_form.php?HitlistID=".$row[3]."&action=edit&Key=".$Key."&lMonth=".$lMonth."&lYear=".$lYear."\">".$row[2]."</A></TD>\n";
echo "<TD align=\"right\">".number_format($row[4],2)."</TD>\n";
echo "<TD align=\"center\">$row[5]</TD>\n";
?>
<TD>
<SELECT name="Status[$i]" onChange="form.submit();">
<?php
$result3 = odbc_do ($con, "SELECT * FROM HitlistStatusCodes");
while (odbc_fetch_into($result3, $row1) != False)
{
echo "\t\t<OPTION value=\"".$row1[0]."\"";
if ($Status[$i] == $row1[0])
echo " SELECTED";
echo ">".$row1[0]."</OPTION>\n";
//echo ">".$Status[$i]."</OPTION>\n";
}
?>
</SELECT>
</TD>
<?php
echo "</TR>\n";
$HitID[$i] = $row[3];
$query1 = "INSERT INTO HitlistTemp (HitID , Status) VALUES ( $HitID , '$Status[$i]' ) ";
//odbc_do ($con, $query1);
$i++;
}




Reply With Quote