i m trying to send a value from one page to another by using java script, where the user is redirected to the other php page oncick, the problem i m having is sending a value to the other page the code on 1st page is
<html>
<body>
<div id="management" onclick="myFunction()" class="col-md-2">
<p>Management</p>
</div>
<script>
function myFunction() {
var search="Assam";
location.href = "search.php";
}
</script>
</body>
</html>
and i want the value of search to be forwarded to the second search.php page
$search=how do i get the variable here;
$query = $pdo->prepare("select * from collegetable where name LIKE '%$search%' OR courses LIKE '%$search%' OR address LIKE '%$search%' OR affiliation LIKE '%$search%' LIMIT 0 , 10");
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();
// Display search result
if (!$query->rowCount() == 0) {
echo "Search found :<br/>";
echo "<table style=\"font-family:arial;color:#333333;\">";
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">College Names</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">Courses</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">Price</td></tr>";
while ($results = $query->fetch()) {
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['name'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['courses'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['fees'];
echo "</td></tr>";
}
echo "</table>";
} else {
echo 'Nothing found';
}