Hi all,

I can manage this script to work.
Js warn about listid[], he doesnt like [] in a var name !
Php needs them to collect an array from form checkboxes.

Here is my source :

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>


<SCRIPT LANGUAGE="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 "nowhere"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false;
}
checkflag = "false";
return "everywhere"; }
}
</script>
</head>
<body>

<?
print_r($listid); // what in listid ?
?>

<form name=test action=check.php>

<input type=button value="partout"
onClick="this.value=check(this.form.listid[])"><br>

<input type="checkbox" name="listid[]" value="1">1<br>
<input type="checkbox" name="listid[]" value="2">2<br>
<input type="submit">
</form>

<script>
var obj=eval('document.test.listid[]');
alert(obj); // no object !

</script>
</body>
</html>

Thanks.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to