I was doing a PHP project and want the elements in array to be named as id[2], id[4] etc.
When I tried to validate those form fields using javascript as :
document.formname.id[6].value
an error occurs. please help
Below gievn is the sample code portion
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function toggle(){
frm = document.test
alert(frm.select1(1).value);
}
</script>
</head>
<body>
<form action="test.php" method="post" name="test">
<p>
<select name="select1[1]" onChange="javascript:toggle()">
<option value="0">test</option>
<option value="1">main</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>