I have a series of pages that have nearly identicle queries. The only things that change are the cities and counties. I'm trying to make pages where I declare variables defining the city and county at the top of the page, then php include the file with all of the common queries. At first I though I might need to make the city and county variables global so they could be within the scope of the included files, but from what I've read here and elsewhere, putting the variable in a session, which is alrady global, would be the way to go.
Presently, I'm simply declaring my variable like so:
Code: Select all
$thiscity = 'Springfield';After I start the session, do I just declare
Code: Select all
$_SESSION['city'] = 'Springfield';I'm guessing there are a few different ways to do this, but the end goal is to make this series of pages easy to replicate to apply to different cities.
Any thoughts?