PHP Form Script (2) with MySQL

I am creating a webform and have a question about setup. The advisor using the form has to go through a checklist with departing students. There are a number of checkboxes that are dependent on each other I am trying to figure out how to code to the webform. For example the advisor has to check whether or not they asked the student about the status of their ID Card. They then have to check if they were able to collect it or not. So basically you have a checkbox for "ID Card" and a radio button to check either "Collected" or "Not Collected". The form is incomplete and should not be submitted without this information. There is some reverse logic here too. If the advisor selects one of the two radio buttons, the checkbox would automatically get a check because by signifying it has been either collected or not collected by default the advisor would have had to ask. That being said there should be no preset default setting for the radio buttons. So, can anybody help me set this up by putting the PHP code within an HTML table?
bpfsrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rtuplinCommented:
Having dependability between HTML form items would fall to Javascript rather than PHP as its client side, not server side.

If you wanted to check what a tick box or radio button was once the form was submitted, then yes, this can be done with PHP.  However, getting the radio button to automatically tick the ticket box is pure javascript, so you may be better off asking the question on the javascript board.
0
houssam_balloutCommented:
Well, doing that so in php is much better because some browsers may had been disable JavaScript.
For example to see where a checkbox has been enabled in php use:


<?php
//VariablaName is the name of the checkbox
if(isset($_POST['variableName']))
{
//If it has been checked then set the variable to true
$myVar = 'true';
//and here you can also set the radio button to on also
 
 
}
 
 
?> 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Loganathan NatarajanLAMP DeveloperCommented:
you may check each and every form field  (check boxes) value ... whether it is empty or checked... if it is empty just have default value (0 or 1) to the variables ... so the problem will be solved...

as **rtuplin** said, it could be done very well using Javascript after validating the form... or while submitting the form
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.