I have been going crazy trying to figure out how to query a php database upon different buttons the user may press. For example clicking on one button will query the database to return values where age > 30, while clicking on a different button will send a different query so age < 30.
I know that you cannot run a php function directly from a button onclick, however you can run javascript. I have been trying to use javascript that is called from the button to run php queries but its very messy (and isn't working).
I don't have any experience with ajax which may apparently be a solution, but would much rather avoid it.
I don't have to use buttons, I just need a way for the users to choose different queries.
How could I do it?