Hopefully Simple Question re Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew

    Hopefully Simple Question re Variables

    I'm learning PHP so this might be a simple question to more expeienced
    developers hopefully.

    I have a findrecords.php page which has the following code which creates a
    new record in a database table if this is the first time the user performs a
    search:

    // Web Session tracking
    if (isset ($_SESSION['new_search'])) {
    // nothing - we don't want to add a new record if this is set
    } else {
    $request = $fm->newAddCommand( 'web_sessions') ;
    $result = $request->execute();

    $recordID = $result->getFirstRecord ()->getRecordId( );
    $_SESSION['new_search'] = "Yes";
    $_SESSION['web_session_id '] = $recordID;
    }


    On the recordlist.php page which displays the search results there are 2
    links:

    1 - Continue searching - this should just go back to the findrecords.php
    page and let the user do another search (this is working fine)

    2 - New Search - this should take the user back to the findrecords.php page
    and clear the $_SESSION['new_search'] variable only if that link is clicked.

    I can't work out how you can pass some kind of parameter to the
    findrecords.php page to indicate that the user has click the "New Search"
    link? If I can capture that I can clear the variable but this one has me
    stumped?

    Many thanks,
    Andrew


  • Geoff Berrow

    #2
    Re: Hopefully Simple Question re Variables

    Message-ID: <7dslk.25301$IK 1.5879@news-server.bigpond. net.aufrom
    Andrew contained the following:
    >2 - New Search - this should take the user back to the findrecords.php page
    >and clear the $_SESSION['new_search'] variable only if that link is clicked.
    >
    >I can't work out how you can pass some kind of parameter to the
    >findrecords.ph p page to indicate that the user has click the "New Search"
    >link? If I can capture that I can clear the variable but this one has me
    >stumped?
    Make the link findrecords.php ?action=newsear ch

    Then at the top of findrecords.php

    if(isset($_GET['action']) &&$_GET['action']=="newsearch" ){
    unset($_SESSION['new_search'] );
    }


    However, from a users point of view, what is the difference between
    continue searching and a new search?
    --
    Geoff Berrow 011000100110110 0010000000110
    001101101011011 001000110111101 100111001011
    100110001101101 111001011100111 010101101011
    The Slippery Hill Boys Tel: 07985 425932. American themed barn dances and bluegrass performances. Stoke on Trent, Newcastle under Lyme, Staffordshire, Cheshire and surrounding areas.

    Comment

    Working...