hi !
below is a simple html code which lets a user input a value and then passes it to a php program which runs a sql querry againt an oracle database displaying the result set.
what I would like to do is to be able to offer a drop down list of values to select from ( which will come from a table in oracle) instead of the user remembering n entering a value, how can i achieve that ?
thanks
Sami
--------------------------------------------- form2.html -----------------------------------------------------------------
<form method="POST" action="select2.php">
<div align="left"><p><font face="BankGothic Md BT">host name?</font>
<input type="text" name="host" size="14"><input type="submit" value="Submit"></p>
</div></form>
---------------------------------------------- select2.php -----------------------------------------------------------
<?php
$host = $_POST["host"];
$hostname=strtoupper($host);
$conn = oci_connect('SAMI', 'SAMI', 'emrep');
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
$query = "SELECT * FROM INSTANCE where HOST_ID in (select HOST_ID from HOST_LOOKUP where HOST_NAME='$hostname')" ;
$stid = oci_parse($conn, $query);
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
$r = oci_execute($stid, OCI_DEFAULT);
if (!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}
print '<table border="1">';
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print '<tr>';
foreach ($row as $item) {
print '<td>'.($item?htmlentities($item):' ').'</td>';
}
print '</tr>';
}
print '</table>';
oci_close($conn);
?>