Php使用模型-视图-控制器模式获取无线电输入值时遇到的问题

Php使用模型-视图-控制器模式获取无线电输入值时遇到的问题,php,html,forms,Php,Html,Forms,我试图在一个表单中获取一组无线电输入的值,但它不起作用 视图: 型号: class ContactoModel extends DB { const FILTER_MESSAGEC = "SELECT * FROM inventario WHERE category=?"; . . . public function filterTable($filterRecord){ $this->open_connection ();

我试图在一个表单中获取一组无线电输入的值,但它不起作用

视图:

型号:

class ContactoModel extends DB {
    const FILTER_MESSAGEC = "SELECT * FROM inventario WHERE category=?";
    .
    .
    .
    public function filterTable($filterRecord){
        $this->open_connection ();
        if (key($filterRecord)=="categoria") {
            $statement = $this->conn->prepare ( self::FILTER_MESSAGEC );
            $statement->bind_param ("s", $filterRecord["categoria"]);
        }
        $sucess = $statement->execute();
        $result = "Fail";
        if (! $sucess) {
            throw new Exception ( 'Lo sentimos ha ocurrido un error contacte al administrador' );
        }
        else{
            $result= $statement->get_result();
        }
        $statement->close ();
        $this->close_connection ();
        return $result;
    }
图1:

我知道逻辑是正常的,因为对于另一种类型的输入,如
textarea
,它可以工作!但是我不知道收音机的输入类型会发生什么,我一直在尝试和搜索,但是我找不到(

图2:

显然,我在字段类别中有带有
papeleria
的条目


有什么建议吗?谢谢。

您不能提交
禁用的
输入。因此,请删除所有单选按钮上的属性
禁用的

编辑:

给你的3个检查按钮一个类名,例如
btn filter
,并使用下面的代码。我认为它应该适用于你当前的HTML结构

$('.btn-filter').on('click', function (e) {
  e.preventDefault();
  // cache the elements you need
  var $btn = $(this),
      // cache the inputs (input, textarea, button, select) excluding .btn-filter button
      // within the column
      $inputs = $btn.closest('[class^=col]').find(':input:not(.btn-filter)');
  // de-activate button and disable his sibling inputs
  if ($btn.hasClass('active')) {
      $btn.removeClass('active');
      $inputs.prop('disabled', true);
  // activate button and enable his sibling inputs
  } else {
      $btn.addClass('active');
      $inputs.prop('disabled', false);
  }
});

这里有一个。

您不能提交
禁用的
输入。因此,请删除所有单选按钮上的属性
禁用的

编辑:

给你的3个检查按钮一个类名,例如
btn filter
,并使用下面的代码。我认为它应该适用于你当前的HTML结构

$('.btn-filter').on('click', function (e) {
  e.preventDefault();
  // cache the elements you need
  var $btn = $(this),
      // cache the inputs (input, textarea, button, select) excluding .btn-filter button
      // within the column
      $inputs = $btn.closest('[class^=col]').find(':input:not(.btn-filter)');
  // de-activate button and disable his sibling inputs
  if ($btn.hasClass('active')) {
      $btn.removeClass('active');
      $inputs.prop('disabled', true);
  // activate button and enable his sibling inputs
  } else {
      $btn.addClass('active');
      $inputs.prop('disabled', false);
  }
});

这是一个。

很好!它可以工作。但是,我禁用了
标记,因为我想通过jQuery删除它。正如您在图片中看到的,我有三个复选按钮:“Categoría”、“Precios”和“Description”.因此,我们的想法是,无论您是否希望使用其中一个来筛选记录,请选中它,或者选中两个,或者选中三个。但是当我尝试使用jQuery时,筛选不起作用。您明白吗?我附上两张关于我正在做的事情的图片[和][我想你说的是,你希望根据相关复选框是否打开/关闭来启用/禁用列中的输入元素。如果是,请查看我上面的编辑。太好了!它可以工作。但是,我使用了
禁用标记,因为我想通过jQuery将其删除。如图所示,我有三个复选按钮:“Categoría”,“Precios”和“Descriptionón”。因此,我们的想法是,无论你想用其中一个过滤记录,都要检查它,或者检查两个,或者检查三个。但是当我尝试使用jQuery时,过滤不起作用。你明白吗?我附上了两张关于我正在做的事情的图片[和][我认为您的意思是,您希望根据相关复选框是否处于打开/关闭状态来启用/禁用列中的输入元素。如果是,请查看上面的编辑。
$('.btn-filter').on('click', function (e) {
  e.preventDefault();
  // cache the elements you need
  var $btn = $(this),
      // cache the inputs (input, textarea, button, select) excluding .btn-filter button
      // within the column
      $inputs = $btn.closest('[class^=col]').find(':input:not(.btn-filter)');
  // de-activate button and disable his sibling inputs
  if ($btn.hasClass('active')) {
      $btn.removeClass('active');
      $inputs.prop('disabled', true);
  // activate button and enable his sibling inputs
  } else {
      $btn.addClass('active');
      $inputs.prop('disabled', false);
  }
});