I can't get the info from table departments to show up in the drop down menu.
Pls. help. here is code
odbc.php
<?php
$odbc = odbc_connect ('Tools', '', '') or die('Could Not Connect to ODBC Database!');
?>
<?
if(!function_exists('odbc_fetch_array'))
{
function odbc_fetch_array($result, $rownumber=-1)
{
if (PHP_VERSION > '4.2')
{
if ($rownumber < 0)
{
odbc_fetch_into($result, $rs);
}
else
{
odbc_fetch_into($result, $rs, $rownumber);
}
}
else
{
odbc_fetch_into($result, $rownumber, $rs);
}
$rs_assoc = Array();
foreach ($rs as $key => $value)
{
$rs_assoc[odbc_field_name($result, $key+1)] = $value;
}
return $rs_assoc;
}
}
?>
new iron.php
<?php
require_once('odbc.php');
$result = odbc_exec($odbc,"SELECT * FROM Departments") or die (odbc_errormsg());
$pulldown = '<option value =$row[D_department]';
while($row = odbc_fetch_array($result))
{
$pulldown .='<option value= $row[D_department]></option>';
}
odbc_close($odbc);?>
<html>
<head>
<title>New Irons</title>
<link rel=stylesheet type="text/css" href="http://192.168.1.56/wod.css">
</head>
<body vlink="blue" alink="blue" bgcolor="silver">
<table border="1" bgcolor="silver" align="center">
<tr>
<td rowspan="20" valign = "top"><img src="http://192.168.1.56/logo_sm.gif" align="left"/></td>
<td colspan="2" class=titleline valign="top">Add New Iron</td>
</tr>
<tr>
<form action="NewIron.php" method="post">
<td>SI No:<td> <input type="text" name="SiNo" >
</tr><br>
<tr>
<td>Watts:
<td> <input type="text" name="Watts">
</tr><br>
<tr>
<td>Department:
<td><select name="Dept">
<?php echo $row ; ?>
</select>
</tr><br>
<tr>
<td>Status:
<td> <input type="text" name="Status" >
</tr><br>
<tr>
<td>Notes:
<td> <input type="text" name="Notes" >
</tr><br>
<tr align="center">
<td><input type=submit Name=submit Value="Submit">
<td><INPUT TYPE=RESET NAME=RESET VALUE="Reset" ></tr></table>
</form>
</body>
</html>
to post to table
<?php
require_once('odbc.php');
$insert = odbc_exec($odbc, "INSERT INTO Irons2 (I_SiNo, I_Watts, I_Department, I_Status, I_Notes)
VALUES
('$_POST[siNo]','$_POST[Watts]','$_POST[Dept]','$_POST[status]','$_POST[Notes]')");
echo "record added";
odbc_close($odbc);
?>