javascript incompatible with php ?
Posted: Thu Nov 09, 2006 10:01 pm
The following script works for javascript but the problem is my php script can only capture a value from one reason text box
The following script works fine for php as i am able to captured all the value in the text field but my javascript refuse to work.
Any solution that I can use to use both at the same time ??
Code: Select all
<script language="JavaScript">
<!--
for(i=0; i< document.ptform.reason.length; i++){
total = total + parseInt(document.ptform.reason[i].value);
}
if(total != parseInt(document.ptform.rejected.value)){
str = str + "Reject Qty and Fault Entered does not match.\n";
}
//-->
</script>
<form name='ptform' action="process.php" method="POST" onSubmit="return validate_form(this);">
<input type='text' class='textc' value='' name='reason'>
<input type='text' class='textc' value='' name='reason'>
<input type='text' class='textc' value='' name='reason'>
<input type='text' class='textc' value='' name='reason'>
</form>The following script works fine for php as i am able to captured all the value in the text field but my javascript refuse to work.
Code: Select all
<script language="JavaScript">
<!--
for(i=0; i< document.ptform.reason.length; i++){
total = total + parseInt(document.ptform.reason[i].value);
}
if(total != parseInt(document.ptform.rejected.value)){
str = str + "Reject Qty and Fault Entered does not match.\n";
}
//-->
</script>
<form name='ptform' action="process.php" method="POST" onSubmit="return validate_form(this);">
<input type='text' class='textc' value='' name='reason[]'>
<input type='text' class='textc' value='' name='reason[]'>
<input type='text' class='textc' value='' name='reason[]'>
<input type='text' class='textc' value='' name='reason[]'>
</form>Any solution that I can use to use both at the same time ??