i am creating a form for searching a client, using either id or email both are set to be unique. Application made on ***Codeignitor***.

1. I have created a form with two radio buttons, one for **search with ID** and another for search with mail+dob.
2. Depending on the radio button selected, corresponding input fields shown.
3. In controller, it choose the model function based on the radio button value.

This is I coded, i need to pass the value of radio button to `Controller.php` file

**Form(only included the radio button)**

```js
$(document).ready(function() {
  $("#usingdob").hide();
  $("#usingmail").hide();
  $("input:radio").click(function() {
    if ($(this).val() == "id") {
      $("#usingId").show();
      $("#usingdob").hide();
      $("#usingmail").hide();

    } else {
      $("#usingId").hide();
      $("#usingdob").show();
      $("#usingmail").show();
    }
  });
});
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-md-4">
  <label class="radio-inline">
<input  type="radio" name="optradio" value="id" checked>Using ID </label></div>
<div class="col-md-4">
  <label class="radio-inline">
<input  type="radio" name="optradio" value="mail">Using DOB</label>
</div>
```

I expected to get the radio button value correctly[enter image description here](https://i.stack.imgur.com/gjmLQ.png)
[![enter image description here](https://i.stack.imgur.com/gjmLQ.png)](https://i.stack.imgur.com/gjmLQ.png)