CREATE TABLE `main` (
`device` varchar(32) NOT NULL,
`model` varchar(50) NOT NULL,
`name` varchar(32) NOT NULL,
`ip` varchar(30) NOT NULL,
`location_id` int(4) NOT NULL,
`serial_number` varchar(50) NOT NULL,
`status` varchar(20) NOT NULL,
`last_update` date NOT NULL,
`attachment` varchar(32) NOT NULL
)
Code
<form name="form1" method="post" action="save_main.php">
<FONT FACE="arial"><table width="400" border="0" style="width: 600px">
<ul class="blue">
<tbody>
<tr>
<td><a></t>Device</a></td>
<td>
<label>
<select name="lmName1">
<option value="">- Select Device</option>
<?
$strSQL = "SELECT * FROM main status group by device ORDER BY device";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["device"];?>"><?=$objResuut["device"];?></option>
<?
}
?>
</select>
</label>
</td>
</tr>
<tr>
<tr>
<td>Model</td>
<td>
<select name="lmName2">
<option value="">- Select Model</option>
<?
$strSQL = "SELECT * FROM main group by model ORDER BY model ";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["model"];?>"><?=$objResuut["model"];?></option>
<?
}
?>
</select>
</td>
</tr>
<td>Node</td>
<td>
<select name="lmName3" onchange="selectarea(this.value)">
<option value="">- Location Node</option>
<?
$strSQL = "SELECT * FROM location group by location_name ORDER BY location_name";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["location_name"];?>"><?=$objResuut["location_name"];?></option>
<?
}
?>
</select>
</td>
</tr>
</tr>
<tr>
<td><a></t>Sub Node</a></td>
<td>
<label>
<select name="lmName4">
<option value="">- Select Sub Model</option>
<?
$strSQL = "SELECT * FROM location WHERE sub_location != ' ' ORDER BY sub_location ";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["sub_location"];?>"><?=$objResuut["sub_location"];?></option>
<?
}
?>
</select>
</label>
</td>
</tr>
<tr>
<td><a></t>Status</a></td>
<td>
<label>
<select name="lmName5">
<option value="">- Status</option>
<?
$strSQL = "SELECT * FROM main group by status ORDER BY status ";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["status"];?>"><?=$objResuut["status"];?></option>
<?
}
?>
</select>
</label>
</td>
</tr>
<tr>
<tr>
<td>Name</td>
<td>
<input name="txtName" type="text" id="txtName" value="<?=$objResult["name"];?>">
</td>
</tr>
<tr>
<td>ip</td>
<td><input name="txtIP" type="text" id="txtName" value="<?=$objResult["ip"];?>">
</td>
</tr>
<tr>
<tr>
<td>Serial Number</td>
<td><input name="txtSN" type="text" id="txtName" value="<?=$objResult["serial_number"];?>">
</td>
</tr>
<tr>
<tr>
<td></td>
<td><BR><BR>
<input type="submit" name="Submit" value="Save">
</td>
</tr>
</tbody>
</table></FONT>
<br>
</form>