Forum Moderators: coopster

Message Too Old, No Replies

Passing variables using the GET method

         

twist

1:28 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I posted this question in the Apache server area but haven't gotton a reply in 3 days so I thought I would try here,
*********

I have two drop down menu boxes and a button. The user selects from the drop down menus and pushes the button. Instead of using POST I have decided to use the GET method to carry the variables to the next page. Something like this,

ht*p://example.com/page?var1=1&var2=2

I have a rewrite rule like such,

RewriteRule ^page/([0-9]+)/([0-9]+)?$ /page.php?var1=$1&var2=$2 [L]

Is there anyway using the GET method to make the url on the next page appear like this,

ht*p://example.com/page/1/1

I haven't tried using javascript but I don't want to anyway.

Any ideas?

coopster

11:49 am on Jan 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



...to make the url on the next page appear like...

Where? On the page itself in a link? Or in the address bar?

twist

6:47 pm on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the address bar.

I was just wondering if it possible to keep clean url's when using the GET method to pass variables like the example below opening this page,

http://example.com/page/1/1 
[i]instead of[/i]
http//:example.com/page?var1=1&var2=1

<form action="http://example.com/page" method="get"><p>

Drop down box one
<select name="var1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option></select>

</p><p>

Drop down box two
<select name="var2">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option></select>

</p></form>

coopster

1:31 pm on Jan 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



To the best of my knowledge, no. Whatever page the user is requesting is what shows in the address bar.

Why aren't you using method="post"?

twist

8:19 pm on Jan 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, I was just curious if there was a way.

As for post, I notice sometimes it will break the back button or at a minimum give the user a pop-up telling them the page is using post-data and so on. I want users to be able to navigate forward and backwards and be able to bookmark pages. I am not sure, but I don't think there is a way to achieve all this using post. If you know a way, that would be great.