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

dynamic dropdowm list

P: 4
how can i get data from a database into my dropdown list in a html form and
and if i select from the first dropdown list the second dropdown load from the database the crosponding value of the first one dropdown
Feb 27 '07 #1
Share this Question
Share on Google+
3 Replies


10K+
P: 13,264
how can i get data from a database into my dropdown list in a html form and
and if i select from the first dropdown list the second dropdown load from the database the crosponding value of the first one dropdown
You could try loading the data into hidden selects and then use Javascript to play around with the autopopulating ...
Feb 27 '07 #2

P: 32
You could try loading the data into hidden selects and then use Javascript to play around with the autopopulating ...
You can try this after connecting to the database
[HTML]<input name="select">[/HTML]
[PHP]$connection=pg_connect("host=fasfd dbanme=gfd user=fda");
$myresult= pg_exec($connection, "select field_name from table_name");
for ($lt=0, $lt<pg_numrows($myresult); $lt++){
$var=pg_result($myresult, $lt, column_name);

echo "<option>$var<option>";
}[/PHP]
Feb 27 '07 #3

10K+
P: 13,264
You can try this after connecting to the database
[HTML]<input name="select">[/HTML]
[PHP]$connection=pg_connect("host=fasfd dbanme=gfd user=fda");
$myresult= pg_exec($connection, "select field_name from table_name");
for ($lt=0, $lt<pg_numrows($myresult); $lt++){
$var=pg_result($myresult, $lt, column_name);

echo "<option>$var<option>";
}[/PHP]

Perhaps you'd then have
[HTML]<select name="myValues" onChange="autopopulate()">[/HTML]

Then have the js function populating another dropdown with values that depend on the currently selected values from the database
Feb 27 '07 #4

Post your reply

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