Trouble with PHP sessions -
i have html page few buttons take me php page, page handle logic i'm having trouble setting sessions.
i going wrong way i'd appreciate if pointed me in right direction.
this html page code i'm working with:
<form action="reportpage.php"> <center><input type="submit" value="view customers"></center> <?php $_session['customer'] = "checkcustrains"; ?> </form> <form action="reportpage.php" mehtod="post"> <center><input type="submit" value="view admins"></center> <?php $_session['admins'] = "checkcusadmin"; ?> </form>
i each button go reportuser.php page, different session, have if/else statements set in report page display information corresponding session.
how can achieve this? stands, both session variables being set
i suggest use query not session achieve this:
<form action="reportpage.php?customer=checkcustrains"> <center><input type="submit" value="view customers"></center> </form> <form action="reportpage.php?admins=checkcusadmin" mehtod="post"> <center><input type="submit" value="view admins"></center> </form>
and in reportpage.php
:
<?php if(!empty($_get['customer']) && $_get['customer'] == 'checkcustrains'){ //do } if(!empty($_get['admins']) && $_get['admins'] == 'checkcusadmin'){ //do else } ?>
Comments
Post a Comment