php - Insert value to database from input form

one text

In the firs. Sorry all, but I'm just learning PHP. I'm already sitting on the second day and can't do it anyway. So if any can help me I will be very thankful.

*******SAMPLE *******

sample public function:

 function add_blog_comment($blog_id = "", $user_id = ""){
        $data['comment'] = htmlspecialchars($this->input->post('comment'));
        $data['parent_id'] = $this->input->post('parent_id');
        $data['added_date'] = time();
        $data['blog_id'] = $blog_id;
        $data['user_id'] = $user_id;
        $this->db->insert('blog_comments', $data);
    }

Form:

<div class="col-md-6 text-end">
                                <button class="btn btn-primary" onclick="$('#add_your_comment').toggle();"><i class="fas fa-plus"></i> <?php echo site_phrase('add_your_comment'); ?></button>
                            </div>

                        <div class="w-100 d-hidden mt-3" id="add_your_comment">
                            <form action="<?php echo site_url('blog/add_blog_comment/'.$blog_details['blog_id']); ?>" method="post">
                                <div class="form-group">
                                    <textarea class="form-control" rows="4" placeholder="<?php echo site_phrase('enter_your_reply'); ?>" name="comment"></textarea>
                                    <input type="hidden" name="parent_id" value="">
                                </div>
                                <div class="form-group my-3">
                                    <button type="submit" class="btn red py-2 radius-10"><?php echo site_phrase('publish'); ?></button>
                                </div>
                            </form>
                        </div>

This code working. From this I can send comment to DB: enter image description here

*********** ISSUE ************

Now base on this function I try add own function which insert date to table enrol --> domain where current user_id and current course_id: enter image description here

I try create public function: // update domain in enrol table

   function add_domain($course_id = "", $user_id = ""){
        $data['domain'] = htmlspecialchars($this->input->post('domain'));
        $this->db->where('course_id', $course_id);
        $this->db->where('user_id', $user_id);
        $this->db->insert('enrol', $data);
    }

form:

<?php $course_details = $this->crud_model->get_course_by_id($course_id)->row_array(); ?>

<section class="mt-5">
    <div class="container-xl">
        <div class="row">
            <div class="col-lg-9">
                <div class="row">

<div class="col-md-6 text-end">
                                <button class="btn btn-primary" onclick="$('#add_your_domain').toggle();"><i class="fas fa-plus"></i> <?php echo site_phrase('add_your_domain'); ?></button>
                            </div>
                    <div class="col-md-12 pt-4">
          
                        <div class="w-100 d-hidden mt-3" id="add_your_domain">
                            <form action="<?php echo site_url('/home/lesson/free-course-twenty-twenty-motyw-wordpress/1'); ?>" method="post">
                                <div class="form-group">
                                    <textarea class="form-control" rows="4" placeholder="<?php echo site_phrase('enter_your_domain'); ?>" name="domain"></textarea>
                                    <input type="hidden" name="parent_id" value="">
                                </div>
                                <div class="form-group my-3">
                                    <button type="submit" class="btn red py-2 radius-10"><?php echo site_phrase('publish'); ?></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

But nothing is happening. I don't know how I can call this function and I don't know if it's correct. Please forgive me and thank you for any help.

Source