|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I am trying to pass multiple variables for each selection on a form. So far this is my idea:
Code:
<select name="advanced" class="form" id="advanced">
<option value="?h=1" selected>Hedges</option>
<option value="?htmin=8&htmax=14&h=1">--Between 8 and 15 feet</option>
<option value="?htmin=15&htmax=20&h=1">--Between 15 and 20 feet</option>
<option value="?htmin=21&htmax=30&h=1">--Between 20 and 30 feet</option>
<option value="?htmin=31&htmax=50&h=1">--Between 30 and 50 feet</option>
<option value="?htmin=51&htmax=100&h=1">--50+ Feet</option>
<option value="?coldhardy=1">Cold Hardy</option>
<option value="?cr=c&coldhardy=1">--Clumpers</option>
</select>
Am I going about this right? Rich
__________________
Me |
|
||||
|
To do that would require some tricky javascript.
Why not just refer to the variable on the next page via the $_POST array? Your recepient file: Code:
<?php
if ($_POST['advanced'] == "hedges") {
$min = 0;
$max = 0;
$selection = "hedges";
} elseif ($_POST['advanced'] == "8to15") {
$min = 8;
$max = 15;
$selection = "bushes";
}
?>
Of course, you would need to change the values on your form, but that's no big deal. Also, check out PHP's switch structure - it will clean up the if... then, I only used it for ease-of-understanding. |
|
||||
|
Thanks. What I ended up doing is the following:
Code:
<form name="form2" method="post" onSubmit="return dropdown(this.advanced)">
<select name="advanced" class="form" id="advanced">
<option value="photos.php?h=1&s=1" <? if (($p==NULL)or($s==1)){ echo "selected"; }?>>Hedges</option>
<option value="photos.php?htmin=8&htmax=14&h=1&p=1&s=2" <? if ($s==2){ echo "selected"; } ?>>Between 8 and 15 feet</option>
<option value="photos.php?htmin=15&htmax=20&h=1&p=1&s=3" <? if ($s==3){ echo "selected"; } ?>>Between 15 and 20 feet</option>
<option value="photos.php?htmin=21&htmax=30&h=1&p=1&s=4" <? if ($s==4){ echo "selected"; } ?>>Between 20 and 30 feet</option>
<option value="photos.php?htmin=31&htmax=50&h=1&p=1&s=5" <? if ($s==5){ echo "selected"; } ?>>Between 30 and 50 feet</option>
<option value="photos.php?htmin=51&htmax=100&h=1&p=1&s=6" <? if ($s==6){ echo "selected"; } ?>>50+ Feet</option>
<option value="photos.php?coldhardy=1&p=1&s=7" <? if ($s==7){ echo "selected"; } ?>>Cold Hardy</option>
<option value="photos.php?cr=c&coldhardy=1&p=1&s=8" <? if ($s==8){ echo "selected"; } ?>>Clumpers</option>
<option value="photos.php?cr=r&coldhardy=1&p=1&s=9" <? if ($s==9){ echo "selected"; } ?>>Runners</option>
<option value="photos.php?h=1&coldhardy=1&p=1&s=10" <? if ($s==10){ echo "selected"; } ?>>Hedges</option>
<option value="photos.php?la=1&p=1&s=11" <? if ($s==11){ echo "selected"; } ?>>Landscape Accent</option>
<option value="photos.php?culm=1&p=1&s=12" <? if ($s==12){ echo "selected"; } ?>>Unusual Culms</option>
</select>
Rich
__________________
Me |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |