radio button validation



I am making a multiple choice test, using radio buttons, in a form. There are four choices for each question. No buttons are chosen to start.

The form is sent to the php program. I can use php script to mark the answers, but how can I validate to ensure that each question is answered and none are left blank? If one (or more) are left blank, how do I inform the sender?

With Thanks,



Probably the most efficient way would be using JavaScript to validate the form PRIOR to an actual submit to the php script.

A quick google search found this site that could guide you.

You could also actually SUBMIT the form to the PHP script and then validate it on the server… If it validates it then process it otherwise present the form back with the values already selected shown, however this would be less efficient, as every time it needs validating, you would take up bandwidth and processor time.

Don’t get me wrong, you still need to validate on the server, but at this point, if it doesn’t validate, you could react differently knowing that the javascript had validated as far as fields filled out completely. The server validation would be a back up and verifying that the data submitted is correct (for latter processing).

Hope that makes sense. I tend to ramble sometimes.


Thank You,

I will do this.