【问题标题】:Get Checkbox value for edit data PHP获取编辑数据 PHP 的复选框值
【发布时间】:2017-08-24 04:53:16
【问题描述】:
<td align="center"><input type="checkbox" name="checked_id[]" class="checkbox" value="<?php echo $id_student;?>"/></td>


<button type="button" class="btn btn-lg btn-success" onClick="window.location = 'edit.php?ktp=<?php echo $id_student; ?>'">EDIT</button

如何获取复选框的值以在其他 php 页面(如 edit.php)上使用? Id_student = 3454?我的结果可能与我选择的复选框值不同。

【问题讨论】:

  • 必须将 AJAX 与 jquery 或 php post/get 方案一起使用。你想做什么?检查学生然后转到编辑页面?你为什么不直接用那个学生的身份证做一个链接到编辑页面呢?您一次不能进入多个编辑页面,并且使用复选框可以选择多个。您应该使用链接或单选按钮
  • 感谢您的建议。我现在就试试..

标签: php html checkbox


【解决方案1】:

我不确定我是否清楚地理解了您的问题,但根据我的理解,我希望这个示例对您有所帮助

$.ajax( {
    type: 'POST',
    url: '/ajax/checkbox.php',
    data: { foton : $('input:checkbox:checked').val()},

    success: function(data) {
        $('#message').html(data);
    }
} );
/ajax/checkbox.php?name=foton

这里有一个名为name$_GET 参数,它的foton

您在名为foton$_POST 参数 中设置复选框的值。

当您指定数据时,您不必在 $.ajax 网址中设置查询字符串(而不是您想要重定向到将处理您的 $_GET 参数的页面)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-02
    • 2015-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-28
    • 2016-03-20
    相关资源
    最近更新 更多