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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

url variable problem

Status
Not open for further replies.

Dweezel

Technical User
Feb 12, 2004
428
GB
I've used the technique of passing PHP variables in a URL many times without experiencing any problems, but for some reason I've just run into difficulties.

I'm creating an interactive events calender and need to pass two variables into a script on the URL.

I'm using:
Code:
echo "<a href='caldisplay.php?mon=".$month."&year=".$year."'>";
The above code is on the page 'caldisplay.php', so the script is sending the variables back to itself ( again something I've done many times before without problems ).
When the page loads and I click the link the URL dispalys correctly in my address bar e.g:
Code:
[URL unfurl="true"]http://www.mysite/caldisplay.php?mon=8&year=2005[/URL]
but for some reason I'm not able to access the variables.

To try and isolate the problem I made a small test script that contains nothing but the variables and the link. When I click the link on the test script it passes the variables back to itself and they are accesible ( I echoed them to the page ).
What's more the test script worked whether or not I used $year=$_GET['year'] e.t.c. (I think this has something to do with register_globals being on right?)

So I just need to know any possible explanations as to why a correctly written link that contains variables, that displays correctly in the address bar of a browser would not allow me to access those variables?

Any possible soloutions would be greatly appreciated. I think it must be something simple but I'm tearing my hair out with this one.

Cheers.
 
Sorry guys, I've found the problem. I'd duplicated the script creating 'caldisplay2.php' but I hadn't changed the function that was writing the links. So it was sending the variables to 'caldisplay.php'.[blush]

Thanks for looking though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top