Is it possible to retrieve $_POST array values on search results_page?
Posted: 25 June 2008 07:00 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

Hi,

I have tried to retrieve $_POST array values on search results_page and found that neither usual

<?php
$myvar
= $_POST["some_name"];
echo
$myvar;
?>

nor ExpressionEngine’s

<?php
global $IN;
$myvar =  $IN->GBL('some_name', 'POST')
echo
$myvar;
?>

does work.

The code

<?php
echo count($_POST);
?>

outputs zero on search results_page.

In contrast to $IN->GBL(‘some_name’, ‘POST’), $IN->GBL(‘some_name’, ‘COOKIE’) works correctly on search results_page.

So, my question: what’s happening with $_POST array on search results_page? Is it possible to to retrieve $_POST array values on search results_page? Or maybe ExpressionEngine somehow manipulates with those values thus making them unavailable?

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 25 June 2008 07:14 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

I suspect the post array may be stripped when the search form is submitted- if you’re passing extra values along w/the form.  Is that the case?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 25 June 2008 07:15 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

And thinking on what you’re going for- any way you can make use of the tracker array to figure out where they’re coming in from?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 25 June 2008 08:58 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

Hi Robin,

I tried to retrieve $_POST array variables both passing extra values with the form and without passing extra values with the form - and result is the same. Does it means that after submitting a form all values of $_POST array get deleted?

Thanks for pointing out at tracker array - it is really useful construct although not exactly what I need.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 25 June 2008 09:04 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Hm- think it’s the redirect at the end- you’d lose the post array then- see the do_search function in mod.search.php.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 26 June 2008 05:36 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

Hi Robin,

Many thanks for explanation. Now it’s clear what’s happening with $_POST array on search results_page.

The situation with search results_page is quite unfortunate: if there is a need to pass some data to it neither url_segments can be used (forum thread), nor $_POST array variables. As it turns out the only means available for passing data to search results_page are cookies.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 26 June 2008 08:30 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Yep- only way I see to do it.  If it’s mission critical, could hack it.  Which wouldn’t, I think, be too hard.  Might just try tweaking that redirect to stick an extra segment in and see if it works.  If so- that’s the route I’d go if it’s mission critical.  And put in an FR so it takes extra segments.  I didn’t poke the code hard enough to see why it doesn’t seem to like them.

But- we good to close out?  Or you want to shift to ‘How to’ to brainstorm on it more?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 26 June 2008 09:17 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

Hi Robin,

It’s mission critical, but I do not feel myself as yet strong enough in PHP to hack ExpressionEngine’s core files. I will go cookies root since this is well known to me - I have even published Cookie Plus plugin.

There is no need to shift this stuff into “How to” forum. The thread can be closed.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 26 June 2008 09:39 AM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

wink  Hacks are a pain- so if the cookie will do, it’s the better call.  And a feature request is still a good idea as well.

I’ll go ahead and close this puppy out.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64907 Total Logged-in Users: 37
Total Topics: 81850 Total Anonymous Users: 32
Total Replies: 440053 Total Guests: 228
Total Posts: 521903    
Members ( View Memberlist )