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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.