How to detect players on a specific block in Minecraft 1.12.2?

/detect is not a command on it's own. it's a subcommand of execute.

I think what you want is as simple as

/execute @a[..] ~ ~ ~ detect ~ ~-1 ~ <block> <blockstate> /setblock ~ ~-1 ~ air

replace the <block> with the block you're trying to detect and the <blockstate> with the respective blockstate (or a * for "doesn't matter which blockstate").

e.g.:

/execute @a ~ ~ ~ detect ~ ~-1 ~ stone * /setblock ~ ~-1 ~ air

this command will replace any stone block any player is trying to stand on with air.