Jump to content

[SOLVED] Help with a select box out putting PHP


emma57573

Recommended Posts

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>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.