Passing variables in URL not working

software development

#1

I developed a web site on my own dreamhost account at:
http://thewebers.dreamhosters.com/jwh/

The Agents and Homes for Rent pages use links which pass a variable through the URL, so that the page reloads and displays data from the db based on the id. Example: http://www.joelwardhomes.com/homesforrent.php?rental_id=3

I recently moved the site to its permanent address (also a Dreamhost account) at: http://www.joelwardhomes.com/ However, the passing of variables seems to be non-functional for this site in this location. I have no idea why this is happening. It still works at the previous location. I’ve re-copied pages thinking it was a code error, but the identical pages don’t work at this location.

It’s not a database problem, since the listings of rental properties and agents are both dynamic content from the database. Queries work ok.

It appears that the variable is not being passed at all when the page reloads, but the URL shows the variable in the address bar. Ideas, anyone?


#2

Are the two domain/sites running different versions of PHP? :wink:

DreamHost has both PHP 4.4.7 and PHP 5.2.2 available by default, and they have register_globals set differently.

What you are seeing could be caused by the way the variables are passed - the one that works might be using PHP4.4.7.

–rlparker


#3

A-ha! That is worth checking. I’m looking into it now…


#4

development server: 4.4.7
live server: 5.2.3


#5

development server: 4.4.7
live server: 5.2.3

register_globals is indeed turned off in version 5. Thanks for the tip!
Added $rental_id = $_GET[‘rental_id’]; and all is working now.


#6

Good deal!

–rlparker


#7

In that case, you will need to pick up your query string with the $_GET superglobal array.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL