【问题标题】:Submit multiple checkboxes to multiple tables of single database向单个数据库的多个表提交多个复选框
【发布时间】:2015-12-10 13:47:23
【问题描述】:

我有 4 个复选框,所以当我点击提交时,我希望通过 php 在单个数据库的不同表中更新每个复选框。 即

例如: 1. first_eventcheckbox --> firstevent表(数据库)

2. sec_eventcheckbox    --> secondevent table (database)

3. third_eventcheckbox  --> thirdevent table (database)

4. fourth_eventcheckbox --> fourthevent table (database)

所有表都在同一个数据库中。

所以,当我点击提交时,我需要选中复选框以发送到选定的表格

为此我需要 php 代码,即将这些值发送到不同表的 php 代码。 任何帮助都会得到帮助。

提前致谢。

【问题讨论】:

  • 在此处添加您的 php 代码...
  • 我不会编码。我有一个 html 页面,我正在搜索代码以使用 post 方法输入这些值。 www.tynate.in 请检查我开发的这个网站。我需要这些复选框到不同的表。
  • SO 不是代码编写服务。听起来是时候雇人了。

标签: php html mysql checkbox


【解决方案1】:

你可以试试这样的,

if($_POST['first_checkbox']) {
    // insert to first table
}


if($_POST['second_checkbox']) {
    // insert to second table
}

... so on.

【讨论】:

  • 谢谢,我会试试这个方法
【解决方案2】:
if(isset($_POST['event_name']) && !empty($_POST['event_name'])) {
    if($_POST['event_name']=='faceart') {
        //insert into first table
    } elseif ($_POST['event_name']=='dance') {
        //insert into second table
    } elseif ($_POST['event_name']=='nailart') {
        //insert into third table
    } elseif ($_POST['event_name']=='treasurehunt') {
        //insert into fourth table
    }
}

这个答案是根据你的链接提供的:http://www.tynate.in/

【讨论】:

  • 感谢您的努力“克里希纳古普塔”
猜你喜欢
  • 1970-01-01
  • 2021-06-25
  • 2013-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-28
  • 1970-01-01
相关资源
最近更新 更多