jeudi 27 octobre 2016

php page that opens based on checkboxes checked

I have created a dropdown menu with 5 options. There are 6 checkboxes too on the same page along with a NEXT button(input type). The first option of dropdown on being clicked enables first three checkboxes and the second option enables last three (disabling first three) checkboxes. Now I want to open up different php pages for different dropdown options. Let me summarize up like i chose option 1 from dropdown menu and then check option 3 from checkboxes and the when i click on next only page targeted to option 1 from dropdown menu should get open. and there are 5 different pages for 5 options from dropdown. So it should be linked with dropdown and checked box that was checked should go into the database.

here is the code

    <select id="Objective" form="theForm" name="category" >
            <option value="0" selected="1">Choose from dropdown</option>
        <option value="bet">beta</option>
        <option value="theth">thetha</option>
        <option value="p">pi</option>
        <option value="ps">psi </option>
        <option value="alph">alpha</option>
    </select>

<input type="checkbox" class="dissable" onclick="check();" value="1" /> Laptops
<input type="checkbox" class="dissable" onclick="check();" value="1" /> Computers 
<input type="checkbox" class="dissable" onclick="check();" value="2" /> Art 
<input type="checkbox" class="dissable" onclick="check();" value="1" /> Computers Peri
<input type="checkbox" class="dissable" onclick="check();" value="1" /> Movies
<input type="checkbox" class="dissable" onclick="check();" value="2"/> Beauty 

<script>
$("#Objective").on("change", function () {
    $(".dissable[value='1']").prop("disabled", false);
    $(".dissable[value='2']").prop("disabled", false);
    if ($(this).val() == "theth") {
        $(".dissable[value='1']").prop("disabled", true);
    } else if ($(this).val() == "bet") {
        $(".dissable[value='2']").prop("disabled", true);
    } else {
        $(".dissable[value='1']").prop("disabled", true);
        $(".dissable[value='2']").prop("disabled", true);

    }
}).trigger('change');

<input type='submit' name='submit' value='Next' align='right'/>

I think I have made my ques clear and if still doubt persists please ask..




Aucun commentaire:

Enregistrer un commentaire