Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Very Beginner Question

    I have a swim team website - http://www.teamunify.com/Home.jsp?_t...0&team=wzscsma

    I would like to add a page where people can order sweatshirts, t-shirts and tank tops. I think I have found out how to make a page that has drop down menus and a submit button that will email a copy of it to me.

    My question is that I would like to know how to make one option depend on another. For instance - if they choose shirt - the next drop down will show all of the color options for the shirt, but if they choose sweatshirt - it will only show the colors the sweatshirt is available in.


    Sorry if this is a beginner questions, this is my first crack at HTML.

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    The best way to accomplish this would be with a database and server side language. You would create a "query" that would search all records in the database based on the selection of the user. I would assume you're using php, so you could try googling php and Mysql search code, or something like that.

    oops....guess you're using jsp. Not sure if you can find free code for jsp or not, but process is still the same.
    Teed

  • #3
    New Coder
    Join Date
    Jul 2011
    Location
    Pennsylvania
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont know how to modify the drop down box in that way. The only work around I can think of would be to have a drop bown box with sweatshirts, shirts, etc that redirects to another page which has the specific options for that choice.

    The option to send mail is an easy script, but I only know it in PHP, not jsp.

  • #4
    New Coder
    Join Date
    Jul 2011
    Location
    Pennsylvania
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got thinking about your problem and decided to code a little something. This code will make a drop down box displaying sweatshirts, shirts, and t-shirts, as well as a submit button.
    Code:
    <form action="redirect.php" method="post">
    <select name="url">
    <option value="shirts.html">Shirts</option
    <option value="sweatshirts.html">Sweat Shirts</option>
    <option value="tshirts.html">T-Shirts</option
    </select>
    <input type="submit" value="This One">
    </form>
    When an option is chosen it sends the user to a file called redirect.php. This file contains this code
    PHP Code:
    <?php
    $url 
    $_REQUEST['url'];
    if (
    $url 'sweatshirts.html'
    {
      
    header'location: sweatshirts.html');  
    }
    if (
    $url 'shirts.html')
    {
      
    header'location: shirts.html' );
    }
    if (
    $url 'tshirts.html')
    {
      
    header'location: tshirts.html' );
    }
    ?>
    This file will then send them to either shirts.html , sweatshirts.html , or tshirts.html , were you can provide custom options for each type of product.

    Hope this was helpful.


  •  

    Posting Permissions

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