RE: [PHP] Keeping POST values when paging

This is a discussion on RE: [PHP] Keeping POST values when paging within the PHP General forums, part of the PHP Programming Forums category; Yup, some good work there Tedd! In the end I decided the simplest way of coding the functionality was to ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-08-2008
Mayer, Jonathan
 
Posts: n/a
Default RE: [PHP] Keeping POST values when paging

Yup, some good work there Tedd!

In the end I decided the simplest way of coding the functionality was to do
something similar to what Eric said, and have some extra submit buttons in
the form, called Next, Previous and Jump. When clicked, they each submitted
the form again with a different flag set. Along with a session variable
storing the "current" page, I was able to code a reasonably neat solution
deciding which results to show without having to rewrite any sections of my
code. Because these submit buttons are tied to a form at the top of the
page, this has limited me to only having the navigational buttons at the top
of the results table rather than at the bottom too, but that is perfectly
fine in my situation.

Thanks all for your assistance,
Jon.

-----Original Message-----
From: Bastien Koert [mailto:phpster@gmail.com]
Sent: 08 July 2008 15:08
To: Philip Thompson
Cc: PHP-General List
Subject: Re: [php] Keeping POST values when paging


On Tue, Jul 8, 2008 at 9:29 AM, Philip Thompson <philthathril@gmail.com>
wrote:

> On Jul 7, 2008, at 12:46 PM, tedd wrote:
>
> At 2:51 PM +0100 7/7/08, Mayer, Jonathan wrote:
>>
>>> Hiya all,
>>>
>>> I have coded a PHP site on an intranet which forms a MySQL query based

on
>>> multiple inputs on a large form. The form results are POSTed back to
>>> itself,
>>> and query is formed, and the results are returned from the database and
>>> echoed.
>>>
>>> I am looking to set up a basic paging system (back/next, jump to page 3,
>>> etc) in order to limit results for efficiency.
>>>

>>
>> Jon:
>>
>> Here's my version of paging:
>>
>> http://webbytedd.com/bbb/paging/
>>
>> And here's some different styles:
>>
>> http://webbytedd.com/ccc/pagination/
>>
>> Here's an example of paging using ajax -- however, it's not as simple as
>> the others:
>>
>> http://www.webbytedd.com/b1/photo-retouch/
>>

>
> tedd...... this is your best work so far! So maybe I'm a bit biased b/c
> there's beautiful women on it. But hey, what can I say?!
>
> ~Phil
>
>
> Cheers,
>>
>> tedd
>>

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

very nice images

--

Bastien

Cat, the other other white meat
Reply With Quote
  #2 (permalink)  
Old 07-08-2008
Robert Cummings
 
Posts: n/a
Default RE: [PHP] Keeping POST values when paging

On Tue, 2008-07-08 at 16:18 +0100, Mayer, Jonathan wrote:
> Yup, some good work there Tedd!
>
> In the end I decided the simplest way of coding the functionality was to do
> something similar to what Eric said, and have some extra submit buttons in
> the form, called Next, Previous and Jump. When clicked, they each submitted
> the form again with a different flag set. Along with a session variable
> storing the "current" page, I was able to code a reasonably neat solution
> deciding which results to show without having to rewrite any sections of my
> code. Because these submit buttons are tied to a form at the top of the
> page, this has limited me to only having the navigational buttons at the top
> of the results table rather than at the bottom too, but that is perfectly
> fine in my situation.


Just a comment... the submit button/session technique sucks with respect
to passing along links to people. I would suggest scrapping that
approach and going with a GET approach (where the navigational
information is present in the URL). I know my clients almost always want
to be able to paste a URL into an email and have the recipient go
directly to whatever they are viewing. Maybe that's not an issue for you
though... yet ;)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

Reply With Quote
  #3 (permalink)  
Old 07-08-2008
Eric Butera
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <robert@interjinn.com> wrote:
> On Tue, 2008-07-08 at 16:18 +0100, Mayer, Jonathan wrote:
>> Yup, some good work there Tedd!
>>
>> In the end I decided the simplest way of coding the functionality was to do
>> something similar to what Eric said, and have some extra submit buttons in
>> the form, called Next, Previous and Jump. When clicked, they each submitted
>> the form again with a different flag set. Along with a session variable
>> storing the "current" page, I was able to code a reasonably neat solution
>> deciding which results to show without having to rewrite any sections of my
>> code. Because these submit buttons are tied to a form at the top of the
>> page, this has limited me to only having the navigational buttons at the top
>> of the results table rather than at the bottom too, but that is perfectly
>> fine in my situation.

>
> Just a comment... the submit button/session technique sucks with respect
> to passing along links to people. I would suggest scrapping that
> approach and going with a GET approach (where the navigational
> information is present in the URL). I know my clients almost always want
> to be able to paste a URL into an email and have the recipient go
> directly to whatever they are viewing. Maybe that's not an issue for you
> though... yet ;)
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


That isn't practical if your form has 50 fields though.
Reply With Quote
  #4 (permalink)  
Old 07-08-2008
Robert Cummings
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote:
> On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <robert@interjinn.com> wrote:
> >
> > Just a comment... the submit button/session technique sucks with respect
> > to passing along links to people. I would suggest scrapping that
> > approach and going with a GET approach (where the navigational
> > information is present in the URL). I know my clients almost always want
> > to be able to paste a URL into an email and have the recipient go
> > directly to whatever they are viewing. Maybe that's not an issue for you
> > though... yet ;)

>
> That isn't practical if your form has 50 fields though.


I haven't been following the thread very closely... does he have 50
fields?

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

Reply With Quote
  #5 (permalink)  
Old 07-08-2008
Eric Butera
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Tue, Jul 8, 2008 at 12:00 PM, Robert Cummings <robert@interjinn.com> wrote:
> On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote:
>> On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <robert@interjinn.com> wrote:
>> >
>> > Just a comment... the submit button/session technique sucks with respect
>> > to passing along links to people. I would suggest scrapping that
>> > approach and going with a GET approach (where the navigational
>> > information is present in the URL). I know my clients almost always want
>> > to be able to paste a URL into an email and have the recipient go
>> > directly to whatever they are viewing. Maybe that's not an issue for you
>> > though... yet ;)

>>
>> That isn't practical if your form has 50 fields though.

>
> I haven't been following the thread very closely... does he have 50
> fields?
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>


I figured as much. :) He originally wrote:

"I have coded a PHP site on an intranet which forms a MySQL query based on
multiple inputs on a large form. The form results are POSTed back to itself,
and query is formed, and the results are returned from the database and
echoed."
Reply With Quote
  #6 (permalink)  
Old 07-08-2008
tedd
 
Posts: n/a
Default RE: [PHP] Keeping POST values when paging

At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote:
>In the end I decided the simplest way of coding the functionality was to do
>something similar to what Eric said, and have some extra submit buttons in
>the form, called Next, Previous and Jump. When clicked, they each submitted
>the form again with a different flag set. Along with a session variable
>storing the "current" page, I was able to code a reasonably neat solution
>deciding which results to show without having to rewrite any sections of my
>code. Because these submit buttons are tied to a form at the top of the
>page, this has limited me to only having the navigational buttons at the top
>of the results table rather than at the bottom too, but that is perfectly
>fine in my situation.


Jon:

Actually, you don't need to use sessions, post, nor get to pass
variables between scripts.

Here's an example:

http://www.webbytedd.com/bb/tedd/index.php

Of course, the smart ones on this list will figure it out pretty quickly.

Cheers,

tedd

PS: Daniel, please don't offer hints to show how easy this is. I
would like to see what others say.
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #7 (permalink)  
Old 07-08-2008
Philip Thompson
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Jul 8, 2008, at 12:32 PM, tedd wrote:

> At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote:
>> In the end I decided the simplest way of coding the functionality
>> was to do
>> something similar to what Eric said, and have some extra submit
>> buttons in
>> the form, called Next, Previous and Jump. When clicked, they each
>> submitted
>> the form again with a different flag set. Along with a session
>> variable
>> storing the "current" page, I was able to code a reasonably neat
>> solution
>> deciding which results to show without having to rewrite any
>> sections of my
>> code. Because these submit buttons are tied to a form at the top of
>> the
>> page, this has limited me to only having the navigational buttons
>> at the top
>> of the results table rather than at the bottom too, but that is
>> perfectly
>> fine in my situation.

>
> Jon:
>
> Actually, you don't need to use sessions, post, nor get to pass
> variables between scripts.
>
> Here's an example:
>
> http://www.webbytedd.com/bb/tedd/index.php
>
> Of course, the smart ones on this list will figure it out pretty
> quickly.


I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing
it...

~Phil


> Cheers,
>
> tedd
>
> PS: Daniel, please don't offer hints to show how easy this is. I
> would like to see what others say.

Reply With Quote
  #8 (permalink)  
Old 07-08-2008
Thiago H. Pojda
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson <philthathril@gmail.com>
wrote:

> On Jul 8, 2008, at 12:32 PM, tedd wrote:
>
> At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote:
>>
>>> In the end I decided the simplest way of coding the functionality was to
>>> do
>>> something similar to what Eric said, and have some extra submit buttons
>>> in
>>> the form, called Next, Previous and Jump. When clicked, they each
>>> submitted
>>> the form again with a different flag set. Along with a session variable
>>> storing the "current" page, I was able to code a reasonably neat solution
>>> deciding which results to show without having to rewrite any sections of
>>> my
>>> code. Because these submit buttons are tied to a form at the top of the
>>> page, this has limited me to only having the navigational buttons at the
>>> top
>>> of the results table rather than at the bottom too, but that is perfectly
>>> fine in my situation.
>>>

>>
>> Jon:
>>
>> Actually, you don't need to use sessions, post, nor get to pass variables
>> between scripts.
>>
>> Here's an example:
>>
>> http://www.webbytedd.com/bb/tedd/index.php
>>
>> Of course, the smart ones on this list will figure it out pretty quickly.
>>

>
> I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it...
>
> ~Phil



Me neither. I'm guessing: either it's using a file to transfer vars (cookie
or server-written file), or... I don't know :P

Regards,
Thiago

>
>
>
> Cheers,
>>
>> tedd
>>
>> PS: Daniel, please don't offer hints to show how easy this is. I would
>> like to see what others say.
>>

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--
Thiago Henrique Pojda

Reply With Quote
  #9 (permalink)  
Old 07-08-2008
Philip Thompson
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging

On Jul 8, 2008, at 2:42 PM, Thiago H. Pojda wrote:

> On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson <philthathril@gmail.com
> > wrote:

> On Jul 8, 2008, at 12:32 PM, tedd wrote:
>
> At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote:
> In the end I decided the simplest way of coding the functionality
> was to do
> something similar to what Eric said, and have some extra submit
> buttons in
> the form, called Next, Previous and Jump. When clicked, they each
> submitted
> the form again with a different flag set. Along with a session
> variable
> storing the "current" page, I was able to code a reasonably neat
> solution
> deciding which results to show without having to rewrite any
> sections of my
> code. Because these submit buttons are tied to a form at the top of
> the
> page, this has limited me to only having the navigational buttons at
> the top
> of the results table rather than at the bottom too, but that is
> perfectly
> fine in my situation.
>
> Jon:
>
> Actually, you don't need to use sessions, post, nor get to pass
> variables between scripts.
>
> Here's an example:
>
> http://www.webbytedd.com/bb/tedd/index.php
>
> Of course, the smart ones on this list will figure it out pretty
> quickly.
>
> I guess I'm not smart. =( If it's fairly obvious, then I'm not
> seeing it...
>
> ~Phil
>
> Me neither. I'm guessing: either it's using a file to transfer vars
> (cookie or server-written file), or... I don't know :P
>
> Regards,
> Thiago


Technically, SESSIONs and COOKIEs are just files as well, so I don't
think it's a file. Oh oh oh! I know! He's using the Force! Did I get
it right?!

~Philip

Reply With Quote
  #10 (permalink)  
Old 07-08-2008
Stut
 
Posts: n/a
Default Re: [PHP] Keeping POST values when paging


On 8 Jul 2008, at 21:09, Philip Thompson wrote:

> On Jul 8, 2008, at 2:42 PM, Thiago H. Pojda wrote:
>
>> On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson <philthathril@gmail.com
>> > wrote:

>> On Jul 8, 2008, at 12:32 PM, tedd wrote:
>>
>> At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote:
>> In the end I decided the simplest way of coding the functionality
>> was to do
>> something similar to what Eric said, and have some extra submit
>> buttons in
>> the form, called Next, Previous and Jump. When clicked, they each
>> submitted
>> the form again with a different flag set. Along with a session
>> variable
>> storing the "current" page, I was able to code a reasonably neat
>> solution
>> deciding which results to show without having to rewrite any
>> sections of my
>> code. Because these submit buttons are tied to a form at the top of
>> the
>> page, this has limited me to only having the navigational buttons
>> at the top
>> of the results table rather than at the bottom too, but that is
>> perfectly
>> fine in my situation.
>>
>> Jon:
>>
>> Actually, you don't need to use sessions, post, nor get to pass
>> variables between scripts.
>>
>> Here's an example:
>>
>> http://www.webbytedd.com/bb/tedd/index.php
>>
>> Of course, the smart ones on this list will figure it out pretty
>> quickly.
>>
>> I guess I'm not smart. =( If it's fairly obvious, then I'm not
>> seeing it...
>>
>> ~Phil
>>
>> Me neither. I'm guessing: either it's using a file to transfer vars
>> (cookie or server-written file), or... I don't know :P
>>
>> Regards,
>> Thiago

>
> Technically, SESSIONs and COOKIEs are just files as well, so I don't
> think it's a file. Oh oh oh! I know! He's using the Force! Did I get
> it right?!


I've only had a quick look but as far as I can see it's keeping the
vars in a form, the form posts to index.php so I'm guessing index.php
simply includes the script you specify on the form.

Not what I would call "pass[ing] variables between scripts" but that's
just semantics.

-Stut

--
http://stut.net/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:22 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0