Firstly, Php is a server side language. To handle what you have described in the question, you might want to handle that at client-side i.e before any backend processing in done. For instance, javascript would be a great example in this case. you can add javascript:void(0) to your a tag to prevent redirecting and then check if the checkbox is ticked in a javascript function before handling the redirect in the same function. This function can then be attached to an onClick event tied to the "a" tag.