Here is my code:
<?php
$categoryName = $_GET['categoryName'];
$json_data= json_decode($json = file_get_contents("../json/pages.json"), TRUE);
function callDefinition(){
if($json_data[$termName]){
foreach($json_data[termName] as $key => $val){
echo $val;
}
}
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RBC Interactive Glossary</title>
<link rel="stylesheet" href="../css/templateStyle.css">
</head>
<body>
<div id="topHalf">
<img src="../img/home.png" id="homeButton"/>
<button id="categoryTitle"> <?php echo $categoryName; ?> </button>
<?php foreach($json_data[$categoryName] as $term => $definition): ?>
<button class ="defaultButtonLeft"> <?php echo $term ?></button>
<?php endforeach; ?>
</div>
<div id="bottom">
</div>
<script src="../js/jquery-1.7.2.min.js"></script>
<script src="../js/app.js"></script>
</body>
</html>
What happens here is I load some terms based on a category that the user clicks on in the last page the user was in, This was an HTML page that used javascript to pass a variable into the URL. Now I'm trying to do the same thing here (Passing a variable into the URL) but problem I'm running into is a bunch of "cant do that" sites. I don't know if it's just bad googling on my part or what. I was wondering if somebody could tell me how to detect what button was clicked, then pass that buttons specific $definition into the URL which will be transferred to another php page. Is this possible?
Here is my other page, basically a copy of the previous one with minor differences to load the term as a button title, then the deifnition:
<?php
$termName = $_GET['termName'];
$json_data= json_decode($json = file_get_contents("../json/pages.json"), TRUE);
function callDefinition(){
if($json_data[$termName]){
foreach($json_data[termName] as $key => $val){
echo $val;
}
}
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RBC Interactive Glossary</title>
<link rel="stylesheet" href="../css/templateStyle.css">
</head>
<body>
<div id="topHalf">
<img src="../img/home.png" id="homeButton"/>
<button id="termTitle"> <?php echo $termName; ?> </button>
<?php foreach($json_data[$termName] as $term => $definition): ?>
<button class ="defaultButtonLeft"> <?php echo $definition ?></button>
<?php endforeach; ?>
</div>
<div id="bottom">
</div>
<script src="../js/jquery-1.7.2.min.js"></script>
<script src="../js/app.js"></script>
</body>
</html>