I want to pass Javascript variable to PHP, but the value will created at run time by the User.
(我想将Javascript变量传递给PHP,但是该值将在用户运行时创建。)
<html>
<body>
<form >
No of item <input type="" name="no_item" onkeyup="itemValue(this)" />
</form>
<script>
function itemValue(v) {
var a = v.value;
alert(a);
}
</script>
<?php
$no_item = "<script>document.write(a)</script>";
for ($x = 1; $x <= $no_item; $x++) {
echo "Item $x <input type='text' name='item'/>";
}
?>
Description <input type="" name="desc"/>
</body>
</html>
Required Output:
(要求的输出:)
No of item 5
(项目5的数量)
Item 1 __________
(项目1 __________)
Item 2 __________
(项目2 __________)
Item 3 __________
(项目3 __________)
Item 4 __________
(项目4 __________)
Item 5 __________
(项目5 __________)
Description _________
(说明_________)
problem i) Pass js variable to php ii) pass all item varible value to next page and display
(问题 i)将js变量传递给php ii)将所有项目的变量值传递给下一页并显示)
ask by vishal translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…