Hi everyone, i need some help trying to achieve the following. Users enter a page and choose from a drop down list for example when they choose 6 then the page should load 6 text boxes. Im also wondering how we would uniquely name each of the textbox's , Eg textbox 1 would have a name of t_1 and the second would be t_2. hope someone can help me out. Im trying to use javascript with html and php as well in some places

Thanks in advance


Hi there, create the text inputs are very easy.

Check out this example:

	<script type="text/javascript">
		window.onload = function()
			var select = document.getElementById("select");
			var texts = document.getElementById("texts");
			select.onchange = function()
				var val = select.options[select.selectedIndex].value;
				texts.innerHTML = "";
				for(i=0; i < val; i++)
					texts.innerHTML += '<div><input type="text" name="t_' + i + '" value="select_' + i + '" /></div>';
		<select id="select" size="1">
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
			<option value="4">4</option>
			<option value="5">5</option>
		<div id="texts"></div>

It's working, just run it.

Hope it helps.