03.
<head>
04.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
05.
<title>Untitled Document</title>
06.
</head>
07.
08.
<body>
09.
<?
10.
include
"../../include/connectionDb.php"
;
11.
?>
12.
<script>
13.
function
chkall()
14.
{
15.
var
inputs = document.getElementsByTagName(
'input'
);
16.
if
(document.getElementById(
'chkall'
).checked==true)
17.
{
18.
for
(
var
i=0;i<inputs.length;i++)
19.
{
20.
if
(inputs[i].type==
"checkbox"
)
21.
{
22.
inputs[i].checked=true;
23.
}
24.
}
25.
}
26.
else
27.
{
28.
for
(
var
i=0;i<inputs.length;i++)
29.
{
30.
if
(inputs[i].type==
"checkbox"
)
31.
{
32.
inputs[i].checked=false;
33.
}
34.
}
35.
}
36.
}
37.
</script>
38.
<?
39.
$sql_main
=
"SELECT * FROM process"
;
40.
$result_main
= mysql_query(
$sql_main
);
41.
?>
42.
43.
<table>
44.
<?
45.
while
(
$main
= mysql_fetch_array(
$result_main
)){
46.
?>
47.
<tr>
48.
<td align=
"left"
><input type=
"checkbox"
name=
"chk[]"
id=
"chkall"
onclick=
"if(this.checked==true){chkall();}else{chkall();}"
>
49.
<?
50.
echo
$main
[
'processName'
];
51.
$mainid
=
$main
[
'processPK'
];
52.
?>
53.
</td>
54.
</tr>
55.
<?
56.
$sql_sub
= "SELECT * FROM subprocess
57.
WHERE (processFK =
'$mainid'
)";
58.
$result_sub
= mysql_query(
$sql_sub
);
59.
$i
=1;
60.
while
(
$sub
= mysql_fetch_array(
$result_sub
)){
61.
?>
62.
<tr>
63.
<td align=
"left"
>|-<input type=
"checkbox"
name=
"chk[]"
id=
"chk<?=$i;?>"
><?=
$sub
[
'subname'
];?>
64.
</td>
65.
</tr>
66.
<?
67.
}
68.
}
69.
include
"../../include/closeDb.php"
;
70.
?>
71.
</table>
72.
</body>
73.
</html>