www.webdeveloper.com
Results 1 to 2 of 2

Thread: How Are These Created - Process Flow

  1. #1
    Join Date
    Jul 2006
    Posts
    663

    How Are These Created - Process Flow

    Hi, i am working on a site at the moment and i am trying to allow customers to build their orders using a "drop down menu / wizard" where each drop drown menu displays content based on the choice in the previous drop down menu...

    As soon as a user chooses an option in the first drop down menu... a second drop down menu appears and the content is based on the users choice in the previous drop down... etc

    I presume this type of function uses ajax and queries the database each time a selection has been made in the drop down menu...

    Question 1: How should you design these in the database... do i need to create a single table for each option in the first drop down menu... or how should you design your product database
    Question 2: If the answer is YES to the first question... i obviously need to store the contents of each drop down menu in the table, but do i also need to store the actual text labels indicating what each drop down is for on the actual order form, as they will also change based on the choice in the previous drop down menu...

    I have spent the last hour trying to draw out what i mean below... these are not products i have on my site... i am just trying to demonstrate what i mean... i hope my diagram gives a better picture of what i am trying to achieve

    http://i796.photobucket.com/albums/yy242/oo7ml/map.jpg

    thanks in advance for your help...

  2. #2
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    124
    Code:
    <SCRIPT language=JavaScript>
    function reload(form)
    {
    var val=form.userLevel.options[form.userLevel.options.selectedIndex].value;
    //var cid=form.clubid.value;
    self.location='index.php?form=wheel&brandId=' + val ;
    }
    </script>
    PHP Code:
    <form action="POST" style=" margin-top:20px; height:30px; font-size: small; color: #fff;">
                      Brand:<select name="userLevel" onChange="reload(this.form)">
                          <option selected="selected" value="0">--Please Select one--</option><?php
                          $q 
    $database->query("SELECT * FROM `wheel_brand` ORDER BY `brand` ASC ");
                                
    $num_rows mysql_num_rows($q);
                                for (
    $n=0$n<$num_rows$n++) {
                                    
    $brand_id mysql_result($q$n"id");
                                       
    $brand mysql_result($q$n"brand");
                                    if (
    $brand_id2 == $brand_id) {?>
                                         <option value="<?=$brand_id?>" selected="selected"><?=$brand?></option><?php
                                    
    } else {?>
                                        <option value="<?=$brand_id?>"><?=$brand?></option><?php
                                    
    }
                                }
    ?>
                          
                      </select></form>
    now the more of these drop down boxes you add the more var's you will need to add to the javascript... so basically it would be like
    brandid=' +val '&typeid=' +val2...etc much like a yahoo or google search result would look like...

    as far as your database goes i would split it up but that is just me...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles