Use query directly in foreach and use buttons for submit/reset