Hi, I'm still a newbie at using PHP, and I've been trying to populate a combo box with JavaScript using values from a recordset. Anybody knows how I can do that?
You have to program PHP to output sufficient JavaScript to populate the select element, once that JavaScript is run on the client side. Want the best answers? Ask the best questions:
ok, thanks, but i just had a look at the JS forum, and came out completely lost!! Could u please indicate me where the thread talking about what I want is? Thanks a lot!!
function AddText()
{
a=new Option("Option Value here","Text Here" //order may change
document.frm.drpdown.options[document.form.drpdown.length]=a
}
create a dropdown called drpdown and form name must be frm.
create a button like this:
<input type=button value="ADD" onclick="AddText()">
this code is not mine.
the advantage of php is that in html the list is hardcoded, but using php u can add as many as u want.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.