How To Count The Related Fields

hi guys, how are you ?

I have a table in which there are 10 fields related to student skills i.e. skill_1, skill_2 etc, and I am saving these fields using form, now I want that, on the detail page, I have a diabled text field that displays the total numbers of skill that the user entered. so how can I do this as there are 10 fields, so how can I count these fields ?

Thanks in advance.

Can you show the code of your form?

<div class="fields">

                        <label class="field-label" for=skills">Total Skills</label>   

                        <div class="controls">

                            <inputname="" type="text" value="<?php // Here I want to show the tatal number of skill that the users entered.  ?>" disabled="">




if we want to show the total number of posts then the code will be

$countposts = Posts::model->count();  

echo $countpposts;  // it will display the tatal number of posts.

but in my case there are 10 individual fields, and I want to show that in how much fields the skill is entered and how much is blank.