Afternoon,
I found an earlier post that almost gets me what I need. Although my fooling around with it keeps taking down my test server.
First I broke it when I tried to make the select menu do 'selected'. Then I broke it again when I tried to wrap an input text box into a while loop.
If anyone can take a look I would be most apprciative.
Thanks as always: Laura
<?php
include ("UpLoad/connect.php");
$load_sql = "SELECT Facility,FacilityID FROM tblLocation";
if (isset($_POST['cust']))
{
$load_sql .= " WHERE FacilityID='".$_POST['cust']."'";
}
$main_query = mssql_query($load_sql);
$users = array();
while(($fetch = mssql_fetch_array($main_query)) !== FALSE)
{
$users[] = $fetch['FacilityID'];
}
?>
<form name="frm" action="<?PHP echo $_SERVER['PHP_SELF']; ?>?view=cust" method="POST">
<table>
<tr><td>Facility Name:</td>
<td>
<?php
$sql = mssql_query("SELECT FacilityID, Facility from tbllocation");
echo "<select name=cust size=1 onChange='frm.submit();'>";
while ($row = mssql_fetch_assoc($sql))
{
$facilityid = $row['FacilityID'];
$facility = $row['Facility'];
echo '<option value="'.$facilityid.'">'.$facility.'</option>';
}
echo "</select></td></tr>";
?>
<tr><td>FacilityID:</td>
<td>
<?php
echo '<input type="text" name="address" value="';
echo $fetch['FacilityID'];
echo '">';
?>
</td>
</tr>
</table>