The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

what i'm trying to do is.. when a user tricker an action on the page... the var1 is updated to a different value and so the url address... but if the user keep on changing the same variable... the url then display the same variable with different values again and again... what i want is the url address just display the last variable... as shows above

I am assuming that you want specific content to appear, depending on what the value of the variable "var1" is. If that is true, then it should be easy to do. That doesn't mean that is the most efficient way of doing it though, but it would probably work.

I am assuming that you want specific content to appear, depending on what the value of the variable "var1" is. If that is true, then it should be easy to do. That doesn't mean that is the most efficient way of doing it though, but it would probably work.

Hope this helps.

Chris Roane

yes... that's what i wanted to do... could you please tell me how to do it?

There are several ways to do it, but I will explain the most understandable way.

Here is the code that you can use for the main structure of the script.

------------------------
<?
If ($var1 == NUMBER) {

// Content goes here

} Else If ($var1 == NUMBER) {

// Content goes here

} Else If ($var1 == NUMBER) {

// Content goes here

) Else If ($var1 == NUMBER) {

// Content goes here

}

// Note you can use more else ifs, if you need too.
?>
------------------------

You would replace the text "NUMBER" in each if statement, to read all the numbers that you will use. Then, for each number, you place the content that you want to appear if that number is specified, between that specific numbers' if statement. Here is an example piece of code that shows it in action:

------------------------
<?
If ($var1 == 1) {

echo ("Var1 equals one.");

} Else If ($var1 == 2) {

echo ("Var1 equals two.");

} Else If ($var1 == 3) {

echo ("Var1 equals three.");

) Else If ($var1 == 4) {

echo ("Var1 equals four.");

}

// Note you can use more else ifs, if you need too.
?>
------------------------

You should keep in mind that using that method isn't the most efficient way of doing it, but it will work. If you have a lot of content that is inside those if statements, I suggest just creating seperate pages for each of the variables.