philip937:
So im thinking, if the ouput is liek this:
<select name="id[3]" id="attrib-3">
<option value="2">Choose Size..</option>
<option value="5">Medium</option>
<option value="6">Large</option>
</select>
```
>
> The default selected is the top (which is defined by the sort order which controls the order they are written to the page.
>
> So if the url has ?optionselected=6
>
> I could use a php GET and use the result to manipulate the select box liek this:
>
> ```html
<select name="id[3]" id="attrib-3">
<option value="2">Choose Size..</option>
<option value="5">Medium</option>
<option value="6" selected>Large</option>
</select>
```
>
> so im guessing it'll be a variable that is set to nothing by default, for example
> $selected = "";
> and then
> if option value == GET optionselected {
> $selected = "selected";
> }
>
> What d'ya think?
Couple of things, would want to consider the situation where the default (selected) is identified as something other than the first item/is an item that is to be selected ahead of the desired item to select.
Also, regarding your check on the get, you want to be sure that the data passed via the get doesn't get abused to do something undesirable, so a couple of things come to mind and may not be all inclusive. Check/verify if the get variable is set, then want to send the variable through the ZC html cleaning function (sorry I have forgotten what it is called) before attempting to validat it's value(s). In the value checks maintain positive control of what has been provided ie, do something for each selection and if not part of that, then basically disregard the value. Don't rely on the data when choosing the third of three options to necessarily mean that since not one of the first 2 that it must be the third option.
Assuming that the link is something to be "passed out" or posted elsewhere, shouldn't be too much of a problem; however, if the link is to be autogenerated by ZC for display to the customer, that would require additional code to handle that.
Regarding the code suggested, I would assign a variable to the value of the get, do. The cleanup on it, then inside the loop of the attributes, yes that sequence appears as if it would work.