Jump to content

Need some help with radio buttons and check box...


hubertj

Recommended Posts

Hi guys...I need some help in matching data from results of checkboxs and radio buttons.

 

My Intentions:

 

There are 3 radio buttons and 8 check boxes. Users can select any one but cannot don't select at all. I separate the calss and categories because for classes, users can only select 1 option whereas for categories users can select many.

For example, User select class 1 but do not select anything else and click submit...the system will then retrieve that he selected and check the data base if he have the pre requisites to allow him to go through.

 

Coding for my form:

 

<form id="applicationoptions" method="post" action="s_apply_now.php">
<div id="optionshead">Class :</div>
<div id="classoptions">
<input type="radio" name="class" value="1" /> Class 1 Permit       
<input type="radio" name="class" value="2" /> Class 2 Permit       
<input type="radio" name="class" value="3" /> Class 3 Permit
</div>
<div id="optionshead2">Categories :</div>
<div id="catoptions">
<input type="checkbox" name="cat" value="1" /> CAT 2PG         
<input type="checkbox" name="cat" value="2" /> CAT 1OR         
<input type="checkbox" name="cat" value="3" /> CAT 2TT <br/><br/>
<input type="checkbox" name="cat" value="4" /> CAT 3PG         
<input type="checkbox" name="cat" value="5" /> CAT 2OR         
<input type="checkbox" name="cat" value="6" /> CAT 3TT <br/><br/>
<input type="checkbox" name="cat" value="7" /> CAT 4PG         
<input type="checkbox" name="cat" value="8" /> CAT 3OR
</div>
<div class="applynext">
<input class="applynextbutton" type="submit" name="applynextbutton" value="PROCEED" />
</div>
</form>

 

Lets say if user do not select any class, but select CAT 3PG, system will check if user have the pre-requisites before proceeding to next step.

 

Any one can help me or give me hints?? most importantly is i do not know how to retreieve the values selected from the form.

 

Is it possible to do it using php or must i hunt for javascript's script??

 

Thanks in advance guys...greatly appreciate.

Link to comment
Share on other sites

hmm...nope...I have the form already however in this form there is 2 section. The first section is Class: where there will be 3 radio buttons (no multiple selection) Class 1 class 2 and class 3. The next Section,Categories, there will be 8 check box. There will be 8 different categories. The user can select multiple categories. Of the 11 selections in total, the user must at least choose 1 or else a message 'Please choose at least 1 permit type' will appear. And when the user select more then 1 class, for example class 1 and class 3, there should be a message,'Please select only one class'. If user select 1 class and 1 categories or 2 categories, system should proceed to allow them to apply for the permit, which means systems will retrieve the result of selection(s) and store in the database individually. For example if I choose to apply for Class 2 permit and a CAT 2TT permit, system will take the 2 selections separate them and store them in the database as 2 entries. If I choose 2 Categories, system should do the same as well.

 

Screen shot of form: http://imgur.com/qOlv8

 

Coding for form:

<div class="contents">
<form id="applicationoptions" method="post" action="s_apply_now.php">
<div id="optionshead">Class :</div>
<div id="classoptions">
<input type="radio" name="class" value="1" /> Class 1 Permit       
<input type="radio" name="class" value="2" /> Class 2 Permit       
<input type="radio" name="class" value="3" /> Class 3 Permit
</div>
<div id="optionshead2">Categories :</div>
<div id="catoptions">
<input type="checkbox" name="cat" value="1" /> CAT 2PG         
<input type="checkbox" name="cat" value="2" /> CAT 1OR         
<input type="checkbox" name="cat" value="3" /> CAT 2TT <br/><br/>
<input type="checkbox" name="cat" value="4" /> CAT 3PG         
<input type="checkbox" name="cat" value="5" /> CAT 2OR         
<input type="checkbox" name="cat" value="6" /> CAT 3TT <br/><br/>
<input type="checkbox" name="cat" value="7" /> CAT 4PG         
<input type="checkbox" name="cat" value="8" /> CAT 3OR
</div>
<div class="applynext">
<input class="applynextbutton" type="submit" name="applynextbutton" value="PROCEED" />
</div>
</form>
</div>

 

Selections will be store in this Database schema:

permit (PID, EID, PTYPE, STATUS, MID, HRID)

 

PID - Permit ID primary key

EID- Employee ID ( to store the employee ID of the applicant)

PTYPE- Permit Type ( To store the type of permit employee apply for, eg. CAT 2TT)

STATUS- (To know the status of the permit if it is approved or not)

MID- Manager ID ( To store the employee ID of the manger who approve the permit application)

HRID- Human Resource ID ( To store the employee ID of the HR manager who certified the application)

 

 

How do you guys think?? Any way to improve?? Or did anyone do such a system before mind to share??? I am using PHP to achieve the results i am looking for but i am not sure if i am able to do so.

 

This is not commercial for sure.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.