[英]Populate drop down list from Oracle table
I have to populate drop down list from an oracle table I have used following code but it gives an empty drop down list. 我必须从使用以下代码的oracle表中填充下拉列表,但是它提供了一个空的下拉列表。
<!DOCTYPE html>
<html>
<body>
<p style="font-size:35px;"><b>History Trades</b></p>
<form action="dat.php" method="post">
Select Instrument :<select name="instument">
<?php
$conn = oci_connect("cse", "mahesh123", "XE");
$sql = 'SELECT symbol FROM symbols';
$stid = oci_parse($conn, $sql);
$success = oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
{
echo "<option value=\"countryname1\">" . $row['symbol'] . "</option>";
}
?>
</select>
Start Date:
<input type="date" name="bday1" >
End Date:
<input type="date" name="bday2" ><br><br>
<input type="image" src="sub.jpg" alt="Submit" width="100" height="48">
</form>
</body>
</html>
Please help me with this, I need to do it in php code. 请帮我解决这个问题,我需要在php代码中完成。 please help me in the areas where I have the issue in the given code.
请在给定代码中出现问题的区域为我提供帮助。
Field names are upper case by default in Oracle, and array keys are case-sensitive in PHP, so: 在Oracle中,字段名称默认为大写,而在PHP中,数组键区分大小写,因此:
echo "<option value=\"countryname1\">" . $row['SYMBOL'] . "</option>";
Also, turn on error output in your PHP development environment. 另外,在您的PHP开发环境中打开错误输出。 That would have shown a
Notice: Undefined index: symbol in ...
message, allowing you to fix the problem quite quickly. 那将显示一条
Notice: Undefined index: symbol in ...
消息,使您可以非常迅速地解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.