By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Hopefully Simple Question re Variables

P: n/a
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
Aug 4 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Message-ID: <7d******************@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.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?
Make the link findrecords.php?action=newsearch

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 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Aug 4 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.