Can Someone help me to solved my problem. How to count total of value base on dropdown?

for example

        <label for="gender">Gender</label>
          <select name="gender" id="dr" >
          <option value="" selected="selected">Select Your Gender</option>
          <option value="M">Male</option>
          <option value="F">Female</option>
        </select>

Than i want to know how many record in the database contains Male/Female. This Record will be automatically change when we select Male/Female From The Dropdown menu.The count value will show in the textfield.

i hope i have expert that can help me to solve my issue. :)

Select count of male:

SELECT COUNT(*) FROM mydatatable WHERE gender = 'male'

and select count of female:

SELECT COUNT(*) FROM mydatatable WHERE gender = 'female'

Hi AndrisP,

That's for 1 by 1 right?
how about it count by dropdown menu?
i mean, when i select male from dropdown list, it will automatically show count value for male

You'll need to use Javascript/AJAX to request the value from a PHP script.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.