You are doing right.
Just think your html form as a sql creator. The challenge with your case is to create the sql.
On your php, make it very modular. If you have a form to select users by age, sex, and weight, just make your html form with theses 3 criteras in a select box.
Then, make your sql that way:
$sql = 'SELECT whatiwant FROM tableiwant WHERE (1 = 1)'
if ($HTTP_POST_VARS['age']) {
$sql .= ' AND (age BETWEEN ... AND ...)';
}
if ($HTTP_POST_VARS['sex']) {
$sql .= ' AND (sex = ...)';
}
I guess you see how to proceed.