Hi! My name is Jay. Im new in here.
I am a programmer (beginner) and I have this problem which I was not able to solve.
Its my first time also to use PHP.
My problem is that I want to pass an array as an object so that I can access the array in the Javascript. i dont know if this question belongs relatively to php but I was just hoping that somebody could help me this one.
here is my code:
<script Language="JavaScript">
function verify() {
var s1,s2=jay;
s1=0;
do{
if(s2==form1.var[s1].value)
{
event.returnValue=true;
}else{
s1++;
}
}while(s1!=5)
}
</script>
<form name="form1" method="post" action="<?echo $PHP_SELF?>" onSubmit="verify();">
<? $q=0;
do {
$kcd = $cd[$q];?>
<input type="hidden" name="var[]" value="<?echo "$kcd" ?>">
<? $q++;
while(q!=5)
?>
on the Javascript side i dont know if this is correct "form1.var[].value"
on the php side i dont if the values are being submit using the above code.
When I debug the program using
document.write(form1.var[0].value)
in the javascript no value was displayed.
In this case I cannot compare it with the variable s2 having a value of "jay"
Please anyone can who help?