View Full Version : Very Beginner Question
07-23-2011, 08:55 PM
I have a swim team website - http://www.teamunify.com/Home.jsp?_tabid_=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.
07-24-2011, 02:21 AM
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.
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.
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.
<form action="redirect.php" method="post">
<option value="sweatshirts.html">Sweat Shirts</option>
<input type="submit" value="This One">
When an option is chosen it sends the user to a file called redirect.php. This file contains this code
$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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.