Navigation via Bullets and check box combinations

Discussion in 'PHP' started by trochta, Mar 27, 2009.

  1. #1
    I have a form:

    bullets:
    product one
    product two
    product three
    product four

    check boxes:
    w/ option one
    w/ option two

    This creates 16 posibilities that go to 16 different links.

    How can I code this in PHP or javascript?
     
    trochta, Mar 27, 2009 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To help you search, what you are calling bullets are actually called "radio buttons".
     
    SmallPotatoes, Mar 27, 2009 IP
  3. trochta

    trochta Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, SP. I still am having trouble finding the combination of using both radio buttons and check boxes. Any ideas?
     
    trochta, Mar 27, 2009 IP
  4. trochta

    trochta Peon

    Messages:
    135
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I did it in javascript:

    <script>
     function navnav(){
     var pl = {1:[30623,30629,30626,30632], 
               2:[30635,30641,30638,30644], 
               3:[30647,30653,30650,30656],
               4:[30659,30665,30662,30668]};
    
     var i = 0 ;
    
     jQuery('input[@type=checkbox]').each(
         function() {
             if( this.checked ) {
             i = i + parseInt(this.value);
             }
         }
     );
                   
     navnav_id = pl[jQuery('input[@name=prd1]:checked').val()][i]; 
    
     var url = 'https://secure.thesite.com/orderpage.aspx?products='+navnav_id;
    
     window.open(url, '_self'); 
    
     }
    </script>
    Code (markup):
    Here is the form:

    <form method="POST" name="orderForm" >
    <input type="radio" name="prd1" value="1" checked />
    <input type="radio" name="prd1" value="2" />
    <input type="radio" name="prd1" value="3" />
    <input type="radio" name="prd1" value="4" />
    <input type="checkbox" name="checkbox_item[]" value="1" checked />
    <input type="checkbox" name="checkbox_item[]" value="2" checked />
    <input type="image" onClick="navnav(); return false;" src="images/continue.gif" border="0" />
    </form>
    Code (markup):
     
    trochta, Mar 27, 2009 IP