03.
<head>
04.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
05.
<title>test</title>
06.
</head>
07.
<body>
08.
<form action=
"test.php"
id=
"barcodeForm"
method=
"post"
>
09.
</form>
10.
<?php
11.
if
(
empty
(
$_POST
)) {
12.
?>
13.
<script>
14.
var
form = document.getElementById(
"barcodeForm"
);
15.
var
str;
16.
while
((str = prompt(
"Enter barcode : "
,
""
))) {
17.
var
input = document.createElement(
"INPUT"
);
18.
input.type =
"hidden"
;
19.
input.name =
"barcodes[]"
;
20.
input.value = str;
21.
form.appendChild(input);
22.
document.write(str +
" "
+ form.elements.length +
"<br />"
);
23.
}
24.
form.submit();
25.
</script>
26.
<?php
27.
}
else
{
28.
?>
29.
<pre>
30.
<?php print_r(
$_POST
); ?>
31.
</pre>
32.
<?php
33.
}
34.
?>
35.
</body>
36.
</html>