我需要将此值发布到另一个php页面并显示值。 我怎么做?
PHP:
if(!empty($_POST["mytext"])) {
for ($x=1; $x<=$a; $x++) {
echo $txtLine[$x] = $_POST['mytext'.$x];
}
}
代码:
function popuptxt() {
var i = _("no_room").value;
my_div.innerHTML = "";
for (a = 1; a <= i; a++) {
my_div.innerHTML = my_div.innerHTML +
" <input type='text' style='width:50px;' name='mytext'+a> "
}
}
&#13;
<form method="post" action="getvalue.php">
<input type="text" style="width:200px;"
id="no_room" name="no_room" onChange="popuptxt()" required>
<div id="my_div"></div>
</form>
&#13;
答案 0 :(得分:1)
将此更新为您的javascript
function popuptxt() {
var i = _("no_room").value;
my_div.innerHTML = "";
for (a = 1; a <= i; a++) {
my_div.innerHTML = my_div.innerHTML +
" <input type='text' style='width:50px;' name='mytext[]'> "
}
}
将此更新到您的php
if(!empty($_POST["mytext"])) {
foreach ($_POST["mytext"] as $mytext) {
echo $txtLine[] = $mytext;
}
}
它可能适用于您的病情