...

View Full Version : Need to compare items in a drop down list.



kuzco
07-29-2010, 08:02 PM
I want to compare items based on what the user picks there will be 3 drop down menus and the drop down menus should alter the HTML table each time it is changed, giving different option values and stuff. I am wondering how to go about this I have the basic stuff setup but I am not really sure how to add to a table that all 3 options use. Any help would be greatly appreciated.

Here is my current code for the drop downs.


<form name="compare">
<select name="compare">
<option value="V1">Value 1</option>
<option value="V2">Value 2</option>
<option value="V3">Value 3</option>
<option value="V4">Value 4</option>
</select>
<select name="compare2">
<option value="V1">Value 1</option>
<option value="V2">Value 2</option>
<option value="V3">Value 3</option>
<option value="V4">Value 4</option>
</select>
<select name="compare3">
<option value="V1">Value 1</option>
<option value="V2">Value 2</option>
<option value="V3">Value 3</option>
<option value="V4">Value 4</option>
</select>
<input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="Compare">
</form>

I want the user to select one of the options from above and a table to show up showing the differences between the others for example; someone selects Value 1 for compare, and Value 2 for compare 2, and Value 3 for Compare 3, they should be shown a table which has the differences between Value 1, Value 2, Value 3. So lets say Value 1 and Value 3 offers you "Help" while value 2 doesn't. it should show a table that says

Features Value 1 Value 2 Value 3
Help YES NO YES

how would I go about doing this?

Old Pedant
07-29-2010, 09:03 PM
Where are you going to get the table of capabilities of the various values??

That's the hardest part.

And what about if the user chooses "Value 1" in all three <select>s?? Do you care about that?

Philip M
07-29-2010, 09:07 PM
Glad you understood the question, Old Pedant - more than I did! :)

kuzco
07-29-2010, 10:32 PM
Sorry if I was confusing, I was kind of typing in a hurry.

Ok, I'll give more details about this...

I want to set a table up through PHP, I've just tried a few different methods, but they didn't work like I want them to, I had to keep refreshing the page.

I don't want users to be able to select the same value on each comparison item, as other comparisons.

For an example I posted Value 1 above...

Ok I want the table to change or have it to where all I do is put some kind of variable in it where it has the table coding if someone changed it.

Does that make more sense?

Old Pedant
07-29-2010, 10:40 PM
Does that make more sense?

No. Less sense.

I don't understand any of that, except the part where you want to make sure 3 different options are chosen.

I have no idea where the values that you want to display are supposed to come from.

Maybe you need to show a real example????

kuzco
07-29-2010, 11:29 PM
Ok here's an example of a site that does it.

http://www.kia.com/#/compare/?page=ModelSelectorModes.overview

You can select a car on there and then compare it to other cars.

I want to have the same type of setup, but have it to where you select different things instead of cars.

Old Pedant
07-30-2010, 01:27 AM
Okay, so exactly what I said: *WHERE* will you get the data that you will be comparing?

*PROBABLY* you don't want to go get that data until all the options have been selected. But that depends on how many items there are and how much data there is per item.

There isn't any one-solution-fits-all here.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum