tsclan
09-13-2004, 12:26 AM
I have this javascript here
Head
<script language="JavaScript" type="text/javascript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
// End -->
</script>
Body
<input type="checkbox" name="position" value="Admin" class="forminput">
User (Admin) Access<br>
<input type="checkbox" name="position" value="Articles" class="forminput">
Articles Access<br>
<input type="checkbox" name="position" value="News" class="forminput">
News Access<br>
<input type=button value="Select All" class="forminput" onclick="this.value=check(this.form.position)">
That works fine but at the moment I need to name the tick boxes Differently so I can save the data induvidually.
(because at the moment echo $_POST['position']; is just showing one value and not all the vaules that were ticked).
But that would mean the tick all box wont work because they wont be named all the same
Any Help would be great Thanks
Head
<script language="JavaScript" type="text/javascript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
// End -->
</script>
Body
<input type="checkbox" name="position" value="Admin" class="forminput">
User (Admin) Access<br>
<input type="checkbox" name="position" value="Articles" class="forminput">
Articles Access<br>
<input type="checkbox" name="position" value="News" class="forminput">
News Access<br>
<input type=button value="Select All" class="forminput" onclick="this.value=check(this.form.position)">
That works fine but at the moment I need to name the tick boxes Differently so I can save the data induvidually.
(because at the moment echo $_POST['position']; is just showing one value and not all the vaules that were ticked).
But that would mean the tick all box wont work because they wont be named all the same
Any Help would be great Thanks