Everything i read tells me this should work
page 1 is
<?php
$state = $_GET['state'];
$brand = $_GET['brand'];
include ("my_path/state_brand_page_01.php");
?>
page 2 is
<?
//get all dealers for this brand and state
session_start();
include ('../../lib/db.php');
//=======================Start Local Insert
//This stops SQL Injection in POST vars
foreach ($_POST as $key => $value) {
$_POST[$key] = mysql_real_escape_string($value);
}
//This stops SQL Injection in GET vars
foreach ($_GET as $key => $value) {
$_GET[$key] = mysql_real_escape_string($value);
}
//get dealer
echo $state;
echo $_GET['state']; // NOTHING SHOWING
$dquery = mysql_query("SELECT * FROM dealer WHERE state='$_GET[state]' AND brand='$_GET[brand]' ORDER BY company DESC") or die(mysql_error());
?>
I am getting nothing here, no echo of the var, no return from the database. The page works fine on its own, just not when included
Thanks
Maybe your path is interpreted as a URL (like http://www.foo.com/state_brand_page_01.php) and as such include() fetches it using the HTTP methods? That would cause the $_GET to get lost.
Refer to https://www.php.net/manual/en/function.include.php
Below Example #2.