i have a file which includes php and javascript. here is my javascript:
	<script language="JavaScript">

		function AddToIngList (form)

			var Ingredient = form.ingredienttoadd.value;
			form.ingredients_added.value += Ingredient + "\n";

			var objHTML, objText, objinput;

			objHTML = document.createElement('P');

			objHTML.setAttribute('NAME', 'txtTest');
			objHTML.setAttribute('ID', 'txtTest');
			var strTest = form.ingredienttoadd.value;
  			objText = document.createTextNode(strTest);

			objinput = document.createElement
			objinput.name = "input"
			objinput.value = "";


this function is called here:
PHP Code:
                echo"<input type=\"button\" name=\"button\" Value=\"add\" onClick=\"AddToIngList(this.form)\">"
which is a submit button (generated by php for reasons i wont go into here)

so basically everytime someone clicks "button" a new input box is created with the name "input". obviously i want each box to have a unique name which is where my problem lies. is there a way that i can call the newly created input box "input1" and then on the next click, since input1 already exists call it "input2"?
can anyone help?