Click to See Complete Forum and Search --> : select and option


anupriya
08-02-2006, 02:03 AM
hi friends.......

i m new to php please help me friends

how can use select and multiple option method.

i had use with javascript coding, instead of using javascript i want code in php can u help me please

<select name="prodname" onChange="updateprodvarities(this.selectedIndex)" style="width: 150px">
<option selected>Select A Product</option>
<option value="nokia"> Nokia </option>
<option value="sagem"> Sagem </option>
<option value="siemens"> Siemens </option>
</select>

<select name="prodvarities" size="4" style="width: 150px" onClick="">
</select>

<script type="text/javascript">
var prodnamelist=document.input.prodname
var prodvaritieslist=document.input.prodvarities
var prodvarities=new Array()
prodvarities[0]=""
prodvarities[1]=["Nokia 3210|Nokia 3210", "Nokia 3310|Nokia 3310", "Nokia 3330|Nokia 3330"]
prodvarities[2]=["Sagem 930|Sagem 930", "Sagem 932|Sagem 932", "Sagem 936 |Sagem 936 "]
prodvarities[3]=["Siemens C45|Siemens C45", "Siemens S45|Siemens S45", "Siemens ME45|Siemens ME45", "Siemens M50|Siemens M50", "Siemens MT50|Siemens MT50", ]

function updateprodvarities(selectedcitygroup){
prodvaritieslist.options.length=0
if (selectedcitygroup>0){
for (i=0; i<prodvarities[selectedcitygroup].length; i++)
prodvaritieslist.options[prodvaritieslist.options.length]=new Option(prodvarities[selectedcitygroup][i].split("|")[0], prodvarities[selectedcitygroup][i].split("|")[1])
}
}
</script>

another one condition i want another option also while selected nokia then another box their varities should be shown like this Nokia 3210, Nokia ......... ect while u select one in varities Nokia 3210 it should shown in another box ringtone,image, picture image .........like this can u understand?
so i want totally three box using option.

can u help me please

AcousticJames
08-02-2006, 06:50 AM
This sounds like a Javascript question, not a PHP question. Try asking in the Javascript forum.

anupriya
08-02-2006, 07:00 AM
sorry i want the code in php can u understand me

same way i want code in php friend

thanks i got it

thanks for u're reply

bokeh
08-02-2006, 08:19 AM
Well it can only be done with Javascript. What you are attempting is a clientside behaviour. PHP is a serverside scripting language so cannot do that.

NogDog
08-02-2006, 03:06 PM
Or if you want a server-side solution, then you need to break it down into a series of separate forms: select an option on one form, click a "Next" submit button, and get the next form with options based on the prior form's selections. You can use session variables and/or hidden form fields to carry information from previous forms forward through the sequence.