I use JavaScript cookie to accomplish what you're doing in your case:

<script>
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function nav(value)
{
  setCookie('searcheditem', value);
  location.replace('after-search-click.php');
}
</script>

now in my search result display i do:
<a
href="javascript:nav('<?=$search_result['itemid']?>')"><?=$search_result['la
bel']?></a>
.
.
then in whatever page I want the search result item, i access it as:
$searchitem (as named in setCookie() call)


good luck,
Elias


"Chris" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Greetings,
>
>         I am a new user to php and sessions and for the life of me I
> cannot figure this out....
>
> I want to be able to have a user login (which is completed), they goto a
> search page (completed), and search for a particular item (completed). A
> page will display all the links for the items searched for (completed).
> What I want out of sessions is to when they click on the link for a
> particular item, the item number stay in a session so it can be called
> through out each page they goto. What I have as a base of test code is the
> following (this was taken from someone's example):
>
> test1.php:
>
> <?php
>         session_start(  );
>         session_register("SESSION");
>
> *** THE FOLLOWING VARIABLE ($retrived_itemno) WOULD NEED TO BE SET ON THE
> *** SEARCH PAGE ***
> $SESSION["item"] = $retrived_itemno;
>
> $test2Url = "test2.php?PHPSESSID=" . session_id(  );
>
> ?>
>
> <a href="<?=$test2Url ?>">Goto next page</a>
>
>
> test2.php:
>
> <?php
>         session_start( );
>         echo "the retrived value equals: $SESSION[item]";
> ?>
>
>
>
> After you click the hyperlink on test1.php, test2.php will load and the
> session ID is in the URL, but nothing is displayed in the echo for
> $SESSION[item] in test2.php. What is going on?!#!#!$#
>
>
> Thanks a million in advance!!!!!!!!!!!!!!!!!!
> - Chris
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to