Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Define a GET variable and transmit it through URL's

Status
Not open for further replies.

SimoBk

Technical User
Aug 14, 2002
10
CA
Hi all,

Well, actually my question isn't really "How to do", but "How to do it easier"...

What I want :
- A link on every page of my site that should define a GET variable. By clicking on that link from this page, we'd get the following page :
Code:
      index.php            >>    index.php?var=1
      index.php?a=b        >>    index.php?a=b&var=1
      index.php?var=2&a=b  >>    index.php?var=1&a=b

- The variable should then be transmitted from page to page each time I click a link on any page. So, if I click on a link to "main.php" from this page, I'd get the following page :
Code:
      index.php            >>    main.php
      index.php?a=b        >>    main.php
      index.php?var=2&a=b  >>    main.php?var=2

I know it can be done by :
- Using 10's of lines of code that will get the URL, look for ? and &... , and replace depending on what it find... etc.
- Modify each single A HREF by links generated with PHP.

But I am sure there's a simplier way that I just don't now...

Thanks for any help ;)

Simo

Motherboard: Asus CUSL2
Proc: PIII 733MHz
Mem: 256Mb SDRam PC133
Video: ATI All In Wonder 128 Pro (IRQ11)
Sound: SB Live Value (IRQ9 shared with modem and both LAN cards, it's always been like that but it used to work b4)
LAN+Modem: 10/100PCI - 10PCI - 56K
IDE: DVD16x - CD.RW 12.10.32 - 3½ - Master 30Gb 7200rpm - Sla
 
Simo,

From your description, I'm confused as to what it is you actually want.

You say that "A link on every page of my site that should define a GET variable". Links are static HTML - they cannot define variables.

You also say that by "clicking on that link from this page, we'd get the following page", but don't list one page - you list many.

Can you clarify exactly what it is you are wanting?

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan,

Thanks for your answer.

First, the link can be set to execute a JS function.

2nd, as I said, the same link will be available on each and every page, so that's why I gave different examples...
By clicking the 1st on each line, we'd get to the second.

Basically, these would be change language links (&lang=en, &lang=fr...)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top