problem with $_POST array
Posted: Thu Mar 15, 2007 9:45 am
i have the following javascript:
which is called on click of
this works fine and basically what it does is adds the text of what ever has been selected from a drop down box (form.ingredienttoadd.value;) to the end of the page and next to that adds an input box called "input1" and the next one called "input2" etc....
the problem is this. It seems that the value from the input boxes are not goin into the $_POST array.
none of the above code appears.
can anyone help me???
Code: Select all
<script language="JavaScript">
var iteration = 0;
function AddToIngList (form, iteration)
{
var it = iteration;
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
('INPUT');
objinput.name = "input"+it;
objinput.value = "";
document.body.appendChild(objHTML);
objHTML.appendChild(objText);
objHTML.appendChild(objinput);
alert(objinput.name);
}
</script>Code: Select all
onClick=\"iteration ++; AddToIngList(this.form, iteration);\">";the problem is this. It seems that the value from the input boxes are not goin into the $_POST array.
Code: Select all
$test = $_POST['input1'];
echo"<p><b>$test</b></p>";can anyone help me???