hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Session Dropping
Reply

Forum Jump

Session Dropping

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-28-2006, 08:04 PM
mobilebadboy mobilebadboy is offline
WHT Addict
 
Join Date: Jan 2004
Location: Mobile, AL
Posts: 138

Session Dropping


I have a search form that goes to search.php?page=1 (has pagination). At the top of search.php I have:

PHP Code:
<?
session_start
();
$_SESSION['keyword'] = $_POST["keyword"];
?>
Further in my code I explode $_SESSION['keyword'] (to alter the terms for boolean search), implode the terms and pass them off to my MySQL query. This all works, it returns the first page of results. Yet when I click the next page (search.php?page=2) it returns nothing, the session variable no longer exists.

Any ideas as to why this is happening? I'm not super great with sessions, but something simple like this should work.

__________________
Shawn Kerr



Sponsored Links
  #2  
Old 03-28-2006, 11:25 PM
mobilebadboy mobilebadboy is offline
WHT Addict
 
Join Date: Jan 2004
Location: Mobile, AL
Posts: 138
Well, I figured out I was going about it the wrong way anyway. I was trying to recapture what I had already posted and altered for the boolean search. So had it worked, I would have resubmitted the boolean search to be altered for boolean search another time.

But I realized just a few minutes ago that once the script terminates I lose my keywords altogether.

PHP Code:
$keys explode(" "$_POST['keyword']); //back to original code w/o sessions
   
foreach ($keys as $newkey) {
$var[] = "+$newkey";
}
$newkeys implode(" "$var);

// $newkeys is now +keyword1 +keyword2 etc.

// mysql [fulltext] query with $newkeys works

// print results just fine

echo $newkeys// empty, well actually just + 
So I need to figure out how to keep $newkeys alive period, but through the pagination.

__________________
Shawn Kerr

  #3  
Old 03-29-2006, 01:51 AM
mobilebadboy mobilebadboy is offline
WHT Addict
 
Join Date: Jan 2004
Location: Mobile, AL
Posts: 138
Oh well. I just passed everything through the URL. 2 minutes. No headaches.

__________________
Shawn Kerr

Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
Virginia Launches Cybersecurity Startup Accelerator MACH37 Web Hosting News 2013-04-12 12:47:19
Technology Convergence Conference 2013 Web Hosting Events 2013-01-31 19:51:20
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02
cPanel Conference 2012: What's New with cPanel and WHM with Ken Power Web Hosting News 2012-11-12 13:54:56
Desktop Hosting: High-Margin Opportunity for a New Cloud Service – WPC 2012 Web Hosting News 2012-07-11 14:57:43


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?