Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Session debug help

    Hi,

    I've been arround looking for what has been posted and nothing seemed to help me.

    Here's the problem...

    In my search page "search.php" (where the form is) I have set the session:

    PHP Code:
        session_name("mysession");
        
    session_start();
        if(
    session_is_registered("mysession")){
            
    session_destroy("copy_postvars" );
        } 
    After clicking on submit the user is sent to page "search_details.php" where I have the following code for the session:

    PHP Code:
     session_name("mysession");
    session_start();
        if(!
    session_is_registered("mysession_search")){
            
    $mysession_search "last_search";
            
    session_register"mysession_search" );
            
    $copy_postvars=$HTTP_POST_VARS;
            
    session_register"copy_postvars" );
        } else {
            if(!isset(
    $copy_postvars)) $copy_postvars=$HTTP_POST_VARS;
        }
        
        foreach(
    $copy_postvars as $key => $value){
            $
    $key=$value;
        }
        
    if(
    $back=='yes'){
        if(
    $mysession_lastSearch=="detailed"){
            foreach(
    $copy_getvars as $key => $value) $$key=$value;
        } else {
            
    $mysession_lastSearch="detailed";
            
    session_register("mysession_lastSearch");
            
    $start_row=0;
            
    $end_row=10;
            
    $copy_getvars["start_row"]=0;
            
    $copy_getvars["end_row"]=10;
            
    session_register("copy_getvars");
            exit;
        }
        
    } else {
        
    $mysession_lastSearch="detailed";
        
    session_register("mysession_lastSearch");
        
    $copy_getvars=$HTTP_GET_VARS;
        
    session_register("copy_getvars");

    On this page the user may go to the detail page of each result found on the page "codingtips.php".

    Here I only have:

    PHP Code:
    session_start(); 
    I have in this page a link to get BACK to the "search_details.php" page (where the user came from) but when I click there, I do get back to the page but no more with the same results.

    Another strange things that is happening, is that when the user clicks the "order by" buttons on the search results page, instead of ordering only on the found results, the query will order on all items on the database. Hummm..

    Any help would be apreciated.

    Thanks in advance !

  • #2
    New Coder
    Join Date
    Aug 2002
    Location
    New York
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure if I understand what you are asking, but this may help you on the order by question....

    Passing Hidden Variables

    If you don't like the answer on that thread you could try recalling the search query by using $_REQUEST. You have the pass on the search query when you sort the search results otherwise it'll just sort and display everything in the database... I've had this problem for awhile until it was solved today.

    gmitra

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    New York
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Refering back to the other post, $_POST works the first time you try to sort it because it is posting your search query from the other page. After that you use the $_GET statement. Try substituting $_GET for $_REQUEST or follow what was said in the other thread by replacing $_GET with...

    PHP Code:
    <?=$searchparameters?>
    and adding this into your script...

    PHP Code:
    <?php 

    $searchparameters 
    = ( isset($_POST['search']) ) ? $_POST['search'] : $_GET['search'];

    ?>
    Last edited by gmitra; 08-05-2002 at 03:41 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •