PHP dynamic session variable to query another page -
i new php may using wrong method accomplish this. trying use session variable store part of query result: bugid 1, bugid 2, bugid 3 (query works great) , use result clicking bugid on page1.php run query using on page2.php.
<?php if(isset($results)){ foreach($results $r){ $_session["bugid"] = $r ['_source']['bugid']; // assigning session value echo print_r($_session["bugid"]); ?> <div class="result"> <div><br><b>bugid: </b> <a href="page2.php"><?php echo $_session["bugid"]; ?></a> </div> <div><b>attachmenttitle: </b><?php echo $r ['_source']['attachmenttitle']; ?></div> <div><b>attachmentbody: </b><?php echo $r ['_source']['attachmentbody']; ?></div> <?php } } ?> below query on page2.php. problem uses bugid 3 regardless of bugid click on page1.php. not sure if got question out clear enough, appreciate have if solution! thanks.
$query1 = $client->search([ 'index' => 'defects', 'type' => 'detail', 'body' => [ 'query' => [ 'bool' => [ 'should' => [ ['match' => ['bugid' => $_session["bugid"]]], ] ] ] ] ]);
Comments
Post a Comment