By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,133 Members | 1,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,133 IT Pros & Developers. It's quick & easy.

how to select data from oracle db using loop under listbox

P: 45
hi all,

i have a problem with loop in select statement.i m using code : [php]
<select name = "s" size = "1" >
<option selected>P-Code</option>
<option value="P01">P01 </option>
<option value="P02">P02 </option>
<option value="P03">P03 </option>
<option value="P04">P04 </option>
</select></td>[/php]
but i want to select all P-CODE from database using loop.

so how can i do this in php. can anybody please help me?
Feb 28 '08 #1
Share this Question
Share on Google+
5 Replies


ronverdonk
Expert 2.5K+
P: 4,258
You have been around long enough to know that any code must be enclosed within code tags. And if you still don't know read the Posting Guidelines on the subject.

moderator
Feb 28 '08 #2

ronverdonk
Expert 2.5K+
P: 4,258
Show the select statement you are going to use for populating the select list.

Ronald
Feb 28 '08 #3

P: 45
hi
thanks for ur response.

the code i have sent u is using manually select item from the list of item and as many item i write inbetween option value that will show from html form.

but i want to retrieve and show all data in the list box for a specific field from database.


thanks.
Feb 28 '08 #4

ronverdonk
Expert 2.5K+
P: 4,258
hi
thanks for ur response.
the code i have sent u is using manually select item from the list of item and as many item i write inbetween option value that will show from html form.

but i want to retrieve and show all data in the list box for a specific field from database.

thanks.
That is exactly why I asked you to show your MySQL select statement. So we can see how to fill the drop down list. Please show it.

Ronald
Feb 28 '08 #5

ronverdonk
Expert 2.5K+
P: 4,258
I did not mean MySQL of course, but since I always do MySQL it is stuck in my keyboard. To show you what I mean here is a piece of code making a form with a select drop down box that is being populated by the database results (note: MySQL). Question: is this what you have in mind?[php] print "<form method='POST' action='".$_SERVER['PHP_SELF']."'}>\n";
print "<select name='selectit'>\n";
while ($info = mysql_fetch_row($result)) {
foreach ($info as $field)
print "<option value='$field'>$field</option>\n";
}
print "</select>\n";
print "<p><input type='submit' value='Submit' id='myButton'/></p>\n";
print "</form>";[/php]Ronald
Feb 28 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.