PHP 使用按钮 ID 遍历表单
PHP loop through form with button ID
我试图让 php 中的循环工作,遗憾的是,它没有做它必须做的事情,它完全循环数组等,但是当我点击按钮时没有任何反应。只有第一个按钮有效。
这里是:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
到目前为止 JS ^ nog php。不发布整个代码。因为它很长但是这里开始了 for each,完全可以工作。
echo "<table>
<thead>
<tr>
<td>Name</td>
<td>Last Name</td>
<td>Email</td>
<td>Extension</td>
<td>Numbers</td>
<td>Datum</td>
</tr>";
foreach ($response as $key => $value) {
echo "
<tr>
<td>".$value['fname']."</td>
<td>".$value['lname']."</td>
<td>".$value['email']."</td>
<td>".$value['ext']."</td>
";
foreach ($value['numbers'] as $key2 => $numvalue) {
echo"<td>".$numvalue."</td>";
}
echo "<td>";
echo("<form action='<?php echo" . $_SERVER['PHP_SELF'] . "?>' method='post'> <input type='button' name='button' id='datepicker' value='Get call history'></form>");
echo "</td>";
}
echo "
</tr>
</thead>
</table> ";
我想这里有问题:
echo("<form action='<?php echo" . $_SERVER['PHP_SELF'] . "?>' method='post'> <input type='button' name='button' id='datepicker' value='Get call history'></form>");
抱歉代码太长了..
毕竟我找到了正确的答案,确实不得不将其更改为 class 感谢 Tom Hart
$(function() {
$(".datepick2").datepicker({'dateFormat': 'd/m/y'});
});
</script>
和表格
echo("<form action='" . $_SERVER['PHP_SELF'] . ">' method='post'> <input type='button' name='button' class='datepick2' value='Get call history'></form>");
我试图让 php 中的循环工作,遗憾的是,它没有做它必须做的事情,它完全循环数组等,但是当我点击按钮时没有任何反应。只有第一个按钮有效。
这里是:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
到目前为止 JS ^ nog php。不发布整个代码。因为它很长但是这里开始了 for each,完全可以工作。
echo "<table>
<thead>
<tr>
<td>Name</td>
<td>Last Name</td>
<td>Email</td>
<td>Extension</td>
<td>Numbers</td>
<td>Datum</td>
</tr>";
foreach ($response as $key => $value) {
echo "
<tr>
<td>".$value['fname']."</td>
<td>".$value['lname']."</td>
<td>".$value['email']."</td>
<td>".$value['ext']."</td>
";
foreach ($value['numbers'] as $key2 => $numvalue) {
echo"<td>".$numvalue."</td>";
}
echo "<td>";
echo("<form action='<?php echo" . $_SERVER['PHP_SELF'] . "?>' method='post'> <input type='button' name='button' id='datepicker' value='Get call history'></form>");
echo "</td>";
}
echo "
</tr>
</thead>
</table> ";
我想这里有问题:
echo("<form action='<?php echo" . $_SERVER['PHP_SELF'] . "?>' method='post'> <input type='button' name='button' id='datepicker' value='Get call history'></form>");
抱歉代码太长了..
毕竟我找到了正确的答案,确实不得不将其更改为 class 感谢 Tom Hart
$(function() {
$(".datepick2").datepicker({'dateFormat': 'd/m/y'});
});
</script>
和表格
echo("<form action='" . $_SERVER['PHP_SELF'] . ">' method='post'> <input type='button' name='button' class='datepick2' value='Get call history'></form>");