ok, here is the story. I am parsing some values in a javascript in the <head> tags of header.inc. The file index.php calls for header.inc and footer.inc.
Now header.inc is the same for all files. But I need to parse different values in the java.
So here is my setup
in index.php I have
require("common.php");
$query = mysql_query("SELECT *, Cat_ID, Category AS Region FROM $link_table, $cat_table WHERE $link_table.ID = '$ID' AND Cat_ID = $cat_table.ID AND Pending = ''", $db) or die(mysql_error());
$values = mysql_fetch_array($query);
In header.inc I have
<? if ($action == "add_place") {
include("addmap.txt");
}
?>
<?
if ($action == "show"){
include("viewmap.txt");
}
?>
The first include is simple and causes no problem.
the second one is where I pull my info from the query index.php and has:
<script language=javascript>
function InitializeMap()
{
iniMap("Normal");
addLocationsGroup(<? echo "$values[Cat_ID]"; ?>,"<? echo "$values[Region]"; ?>","<? echo "$values[pointer]"; ?>",15);
addLocation(<? echo "$values[Cat_ID]"; ?>,<? echo "$ID"; ?>,<? echo "$values[x]"; ?>,<? echo "$values[y]"; ?>,"<? echo "$values[Name]"; ?>","","<? echo "$values[Address1]"; ?> <? echo "$values[Address2]"; ?>\nPhone:<? echo "$values[Phone1]"; ?>");
showLocation(<? echo "$values[Cat_ID]"; ?>,<? echo "$ID"; ?>);
}
</script>
and works fine only for cat_ID 1. BECAUSE, all the addLocationsGroup must follow an ordered sequence. If the first value (for Cat_ID) is 1, then everybody is happy.
Now, if that values is 18, for example, it will not display, as it requires the 1,2,3,4 etc... to be displayed first, even if they are not needed.
I am pulling info from 2 tables. Except for Region which is the Category name from the Category table, they all come frome the link table. If I get that first line
addLocationsGroup right, then the line below it will be able to display. For example addLocation uses the same cat_id. And since in my test it is a number higher than 1 (8 actually), and since I am missing the first seven, I get a java error.
Hope I am clear. Thanks for helping me.