Skip to content
Advertisement

How to check in PHP if a checkbox is checked or not before posting/submitting?

I’m trying to check if a checkbox has been selected so that if it is, I can then display another textbox, however I’ve tried the below code to try and check if the checkbox is checked or not but keep getting errors. I need to check before the form is submitted/posted as the text field that shows after needs submitting with the form.

HTML + PHP:

JavaScript

All/Any help is appreciated.

Advertisement

Answer

you can try this in front but with checkbox

Form

JavaScript

JS

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement