emma57573 Posted February 20, 2009 Share Posted February 20, 2009 First of all the actual select box works a treat and does what I want it to do The problem I have is with this: gallerytype=<? echo $gallerytype; ?> In the action of the form $gallerytype; does not show in the address bar when I first submit the form, but if I submit the form again then it works as expected but its always one behind. For example: I submit the form for the first time by choosing value 3 and in the address bar it shows: gallerytype= I submit again and choose value 2 and the address shows: gallerytype=3 I submit again and choose value 5 and the address shows: gallerytype=2 etc etc However this works perfectly and is uptodate every time: echo "<option selected=\"selected\" value=\"".$_REQUEST["gallerytype"]."\">".$selectbox."</option>"; $_REQUEST["gallerytype"] AND $gallerytype ARE exactly the same thing, so how come one works as expected and the other only works if you resubmit the form twice? I hope that makes sense, Im not very good at explaining things!! $gallerytype=$_REQUEST["gallerytype"]; <form name="form1" method="post" action="gallerytest.php?cid=<? echo $cid;?>&&keyword=<? echo $keyword; ?>&&keytwo=<? echo $key; ?>&&gallerytype=<? echo $gallerytype; ?>" > <select name="gallerytype" user_id="gallerytype" class="selectbox2" onchange="this.form.submit();" method="post"> <? if ($_REQUEST["gallerytype"] > 1){ echo "<option selected=\"selected\" value=\"".$_REQUEST["gallerytype"]."\">".$selectbox."</option>"; }else{ echo "<option selected=\"selected\" value=\"1\">Listing Date (Newly Listed first)</option>"; } ?> <option value="1">Listing Date (Newly Listed first)</option> <option value="2">Listing Date (Expiring first)</option> <option value="3">Random Shuffle</option> <option value="4">Price (Low to High)</option> <option value="5">Price (High to Low)</option> <option value="6">Featured First</option> </select> </form> Link to comment https://forums.phpfreaks.com/topic/146109-solved-help-with-a-select-box-out-putting-php/ Share on other sites More sharing options...
emma57573 Posted February 20, 2009 Author Share Posted February 20, 2009 Not to worry Ive fixed this Link to comment https://forums.phpfreaks.com/topic/146109-solved-help-with-a-select-box-out-putting-php/#findComment-767051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.