Pass PHP variables without being seen when working with a database generated list
Posted
by
Wilcoholic
on Stack Overflow
See other posts from Stack Overflow
or by Wilcoholic
Published on 2012-09-13T03:09:20Z
Indexed on
2012/09/13
3:39 UTC
Read the original article
Hit count: 152
Looking for any help regarding the problem. Here's the deal: I have a database that has a teams
table and it contains team_id
. On one of my pages, I generate a list of links that contain the team_id
of the creator in their get URL. I need the team_id
on the next page but can't figure out how to pass it through any other way. Using a form and POST isn't an option because this method would only pass through the last links data on the list. Storing in a session isn't an option either because there is no way to discretely pass the the variables I need to a function to set the session variables. I have tried and it can pretty easily be viewed from viewing the source code. So here's some sample code to see exactly what I'm dealing with.
<?
if(mysql_num_rows($result2)>0){ ?>
<a class="fltrt btn btn-danger btn-small" onclick="test()" href="acceptmatch-exec.php?match_id=<?php echo $match_id; ?>&team_id=<?php echo $team_id;?>&action=cancel">Cancel Match</a>
<?}else{?>
<a class="fltrt btn btn-success btn-small" href="acceptmatch-exec.php?match_id=<?php echo $match_id; ?>&team_id=<?php echo $team_id;?>&action=accept">Accept Match</a>
<?} ?>
The code above is generated multiple times on a page via a while loop that was excluded. I want to pass the match_id
and team_id
variables without being seen anywhere. If I made this a form, it wouldn't pass the correct variables unless there is only one result at the time (not likely). I'm sure there has to be an easy method that is eluding me, so please share thoughts on how to solve this. I feel as though I am not explaining it well enough, but it's not really easy to explain. I basically want something that works like GET but acts like POST and can be hidden from people viewing source code or link locations.
Thanks
© Stack Overflow or respective owner