This topic is locked

Best way to set session variable

5/14/2009 8:30:20 AM
PHPRunner General questions
K
KevinMillican author

For each user I have an 'Assignments' table where I set which projects they can access.
I would like them to be able to set a current project by just clicking on a button or the row of a view on their projects.

The intent is to set two session variables - one text one for display, and the other an integer for SQL modification on the various list views they may have access to.
I wondered what the best way was of implementing this and whether anyone had some sample PHP snippet code ?
Eg. my view would have sample data that looked like this :-
ProjectID (int), Project Name (varchar)

1,Big Project A

3,Big Project C

4,Other Project
and I would like to set $_SESSION["CurrentProject"] and $_SESSION["CurrentProjectName"] by clicking on the appropriate row or a button contained in it.
Thanks in anticipation <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=11826&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

J
Jane 5/18/2009

Hi,
here are some tips:

  1. set up ProjectID as custom on the"View as" settings dialog on the Visual Editor tab:
    $value = "<input type=button value=Button1 onclick=\"window.location.href='tablename_list.php?current=".$value."';\">";


2. check $_REQUEST["current"] in the List page: Before process event and fill session variable if needed.

K
KevinMillican author 5/19/2009

Hi,

here are some tips:

  1. set up ProjectID as custom on the"View as" settings dialog on the Visual Editor tab:
  2. check $_REQUEST["current"] in the List page: Before process event and fill session variable if needed.


That's great - many thanks