gwmbox
01-12-2009, 03:38 AM
Hi guys
I have two select boxes of which a user will select an item from select box 1 and then select box 2 will refresh with options that only match the first selected select box.
Second is that I need to have a hidden form output to dynamically change also based on the selection of select box 1.
How do I do this within php, or do I need to use javascript?
I was trying to use strpos but while that works it does not dynamically change the select boxes...
<?php
$size = 'asize';
$findme = 'asizestring';
$sel = strpos($size, $findme);
if ($sel === false) {
echo '<option value="option1Choice1" selected>Option1 choice1</option>
<option value="option1choice2">option1choice2</option>';
} else {
echo '<option value="option2choice1" selected>option2 Choice1</option>
<option value="option2choice2">option2 choice 2';
}
?>
help please :)
Cheers
I have two select boxes of which a user will select an item from select box 1 and then select box 2 will refresh with options that only match the first selected select box.
Second is that I need to have a hidden form output to dynamically change also based on the selection of select box 1.
How do I do this within php, or do I need to use javascript?
I was trying to use strpos but while that works it does not dynamically change the select boxes...
<?php
$size = 'asize';
$findme = 'asizestring';
$sel = strpos($size, $findme);
if ($sel === false) {
echo '<option value="option1Choice1" selected>Option1 choice1</option>
<option value="option1choice2">option1choice2</option>';
} else {
echo '<option value="option2choice1" selected>option2 Choice1</option>
<option value="option2choice2">option2 choice 2';
}
?>
help please :)
Cheers