How to make program that i have one text box and select box,
If i type "a" in text box show all words start with "a" from select box. If i typed "india" in text box then automatically also select "india" from select box in PHP?

a small hint -

function show()
{
	var val = document.getElementById('elem').value;
	//send this "val" to ajax request for the backend page which searches for the "val" and reponse back
	
}
</head>
<body>
<form id="frm" name="frm">
<input type="text" id="elem" name="elem" onkeyup="show();" />
</form>
</body>
Member Avatar for diafol

why not just have an autosuggest box?

agree, because that's what people generally do, and which is best done by the ajax.
But he wants to populate the select element depending upon the contents of the textbox, like if the person types 'i' in the textbox then all the countries starting from letter 'i' should show in the select element.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.