Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Philip Thompson

On Jul 8, 2008, at 4:19 PM, tedd wrote:


At 9:33 PM +0100 7/8/08, Stut wrote:
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


As I figured, the smart ones would figure it out pretty easily.

In the old days when memory was tight we used to do something we  
called overlays.


The process worked like this:

1. Your program would compute what it could with what memory was  
available.


2. Then the program would halt and the variables used to that point  
would be frozen in memory.


3. Then another program was loaded on top of the in situ program  
with spaces in the memory for the values.


4. Then the program would take off again using the new program and  
those variables.


5. The process would repeat as many times as necessary.

Now, in this case I am not swapping scripts because of memory  
restraints, but rather bringing in new scripts to continue with  
another part of the program -- but, I'm exiting the old script.


It turns out to be a very simple process and it works like this.

Run your first script, populate whatever variables you need  
(including post, get, and such) and then figure out where you want  
your program to go (i.e., next phase). Instead of populating a bunch  
of sessions, or filling up a database with values, simply --


ob_clean();
include('theNextScript.php');
exit();

-- and bingo! TheNextScript.php will have all the variables your  
original script had and your old script will be no more.


-Stut is technically right, it's not really passing variables but  
rather "overlaying" a new script on top of the old one.


In any event, I find it a neat way to continue a script without  
having to resort to using sessions, or other such storage  
mechanisms, to "pass" variables to the new script.


Try it -- it works neat.

Cheers,

tedd


Clever, clever. I actually did something along these lines in the app  
I'm currently working on. I had a form, submitted it (to the same  
page), it did it's processing and continued on that page w/o  
forwarding. Mine did, however, use POST. For example,




...

The downfall for doing it this way, w/o redirecting upon submit, is  
not being able to *refresh* w/o being prompted with submitting the  
form again.


Now that I think about it... this has nothing to do with what you did!  
Ha! Ok, I'm going home - I'm tired.


~Phil

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread tedd

At 9:33 PM +0100 7/8/08, Stut wrote:
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


As I figured, the smart ones would figure it out pretty easily.

In the old days when memory was tight we used to do something we 
called overlays.


The process worked like this:

1. Your program would compute what it could with what memory was available.

2. Then the program would halt and the variables used to that point 
would be frozen in memory.


3. Then another program was loaded on top of the in situ program with 
spaces in the memory for the values.


4. Then the program would take off again using the new program and 
those variables.


5. The process would repeat as many times as necessary.

Now, in this case I am not swapping scripts because of memory 
restraints, but rather bringing in new scripts to continue with 
another part of the program -- but, I'm exiting the old script.


It turns out to be a very simple process and it works like this.

Run your first script, populate whatever variables you need 
(including post, get, and such) and then figure out where you want 
your program to go (i.e., next phase). Instead of populating a bunch 
of sessions, or filling up a database with values, simply --


ob_clean();
include('theNextScript.php');
exit();

-- and bingo! TheNextScript.php will have all the variables your 
original script had and your old script will be no more.


-Stut is technically right, it's not really passing variables but 
rather "overlaying" a new script on top of the old one.


In any event, I find it a neat way to continue a script without 
having to resort to using sessions, or other such storage mechanisms, 
to "pass" variables to the new script.


Try it -- it works neat.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread tedd

At 1:32 PM -0400 7/8/08, tedd wrote:
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.



So, this code in the HTML page, at the stage just before the data is 
sent to the script of my choice, isn't using POST to pass the 
variable?



[snip]

[snip]


-Jim



Nope -- an explanation will be soon forthcoming.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread Jim McIntyre

At 1:32 PM -0400 7/8/08, tedd wrote:
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.



So, this code in the HTML page, at the stage just before the data is 
sent to the script of my choice, isn't using POST to pass the 
variable?



[snip]

[snip]


-Jim

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Shawn McKenzie

Stut wrote:


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 
<[EMAIL PROTECTED]> 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


And how would you do that without accessing the $_POST var anyway?

-Shawn

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Stut


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 <[EMAIL PROTECTED] 
> 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/

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Philip Thompson

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

On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson <[EMAIL PROTECTED] 
> 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


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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Thiago H. Pojda
On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson <[EMAIL PROTECTED]>
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


Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Philip Thompson

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.


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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread tedd

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

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Eric Butera
On Tue, Jul 8, 2008 at 12:07 PM, Mayer, Jonathan <[EMAIL PROTECTED]> wrote:
> -Original Message-
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: 08 July 2008 17:01
> To: Eric Butera
> Cc: Mayer, Jonathan; Bastien Koert; Philip Thompson; PHP-General List
> Subject: 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 <[EMAIL PROTECTED]>
> 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.
>
>
> I do have a large form - not quite 50 fields but it would create very long
> URLs!
>
> I take your point, however. In this situation the GET method isn't needed,
> as there will be a very limited number of users who will generally use the
> system independantly of each other, but I understand your reasoning.
>
> So, I've been lucky this time, but it's something I need to consider more
> carefully in the design stage of future projects. PHP programming is a small
> part of my job, with only "hobby" experience to work with, so it's only now
> that I'm moving on to slightly larger projects I'm beginning to see the real
> benefits in the design stage. With this project, I carefully worked out all
> the database design before coding, but didn't do enough on the use-case side
> of things, such as considering the need for paging to ensure system speed
> during a database query with lots of results. So I get to the situation
> where I have 1,000 lines of reasonably decent code, and I'm trying to hack
> in a solution for, say, paging, when it could have been easily handled if it
> was considered more carefully earlier.
>
> Live and learn I guess!
>

I didn't think you had 50, but I got the impression it was quite a bit
more than a simple input box.

Rob is absolutely right though.  I built a system that allowed a user
to "drill down" across 5 levels of criteria.  On each level I stored
the parent's information in sessions so that I could skip all of the
query string and loading of records each time.  Well after all was
said and done the clients soon realized that they couldn't copy and
paste any url's in the system.  It was easy for me in the beginning
cutting down on a ton of code, but didn't work whatsoever for the
client since they really needed to share that information.  So I had
to re-code quite a bit of stuff.  Now whenever I build something I try
to keep it as stateless as possible.  I go out of my way to make sure
that url's stay short too because when they become too long sometimes
the copy and paste thing messes up with email clients text wrapping.

In the end though just try and focus on what the needs are.  If you're
building a user data entry form for a very specific purpose they
probably aren't going to need to share that with others.

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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread Mayer, Jonathan
-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: 08 July 2008 17:01
To: Eric Butera
Cc: Mayer, Jonathan; Bastien Koert; Philip Thompson; PHP-General List
Subject: 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 <[EMAIL PROTECTED]>
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.


I do have a large form - not quite 50 fields but it would create very long
URLs!

I take your point, however. In this situation the GET method isn't needed,
as there will be a very limited number of users who will generally use the
system independantly of each other, but I understand your reasoning.

So, I've been lucky this time, but it's something I need to consider more
carefully in the design stage of future projects. PHP programming is a small
part of my job, with only "hobby" experience to work with, so it's only now
that I'm moving on to slightly larger projects I'm beginning to see the real
benefits in the design stage. With this project, I carefully worked out all
the database design before coding, but didn't do enough on the use-case side
of things, such as considering the need for paging to ensure system speed
during a database query with lots of results. So I get to the situation
where I have 1,000 lines of reasonably decent code, and I'm trying to hack
in a solution for, say, paging, when it could have been easily handled if it
was considered more carefully earlier.

Live and learn I guess!

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Eric Butera
On Tue, Jul 8, 2008 at 12:00 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote:
>> On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <[EMAIL PROTECTED]> 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."

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Robert Cummings
On Tue, 2008-07-08 at 11:57 -0400, Eric Butera wrote:
> On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <[EMAIL PROTECTED]> 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


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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Eric Butera
On Tue, Jul 8, 2008 at 11:33 AM, Robert Cummings <[EMAIL PROTECTED]> 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.

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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread Robert Cummings
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



RE: [PHP] Keeping POST values when paging

2008-07-08 Thread Mayer, Jonathan
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:[EMAIL PROTECTED]
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 <[EMAIL PROTECTED]>
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

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



Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Bastien Koert
On Tue, Jul 8, 2008 at 9:29 AM, Philip Thompson <[EMAIL PROTECTED]>
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


Re: [PHP] Keeping POST values when paging

2008-07-08 Thread Philip Thompson

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



Re: [PHP] Keeping POST values when paging

2008-07-07 Thread tedd

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/

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Keeping POST values when paging

2008-07-07 Thread Per Jessen
Mayer, Jonathan wrote:

> Is there some way of forcing the page to remember and reload the POST
> variables when clicking "next"? Or, if that's difficult, can anyone
> suggest a good way of addressing this problem without too much
> recoding? I'm sure there must be a neater way of doing it then simply
> passing 30 or so variables using GET.

When you build page2, add hidden input variables with the values from
page1 etc. 



/Per Jessen, Zürich


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



RE: [PHP] Keeping POST values when paging

2008-07-07 Thread Mayer, Jonathan
Thanks Wolf and Eric,

I shall experiment with the two options you have suggested.

Cheers,
Jon.

-Original Message-
From: Wolf [mailto:[EMAIL PROTECTED]
Sent: 07 July 2008 14:58
To: Mayer, Jonathan
Cc: 'php-general@lists.php.net'
Subject: Re: [PHP] Keeping POST values when paging


 "Mayer 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.
> 
> The problem I get is that my "next" link - something like
> href='resultspage.php?page=2' - naturally reloads the page without all the
> POST variables it needs to recreate the query.
> 
> Is there some way of forcing the page to remember and reload the POST
> variables when clicking "next"? Or, if that's difficult, can anyone
suggest
> a good way of addressing this problem without too much recoding? I'm sure
> there must be a neater way of doing it then simply passing 30 or so
> variables using GET.
> 
> Many thanks in advance.
> Jon.


Set session variables, have the script check the session variables.

That'll keep the pages rolling, shouldn't take much coding, and you can
change some things on-the-fly.

HTH,
Wolf

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



Re: [PHP] Keeping POST values when paging

2008-07-07 Thread Wolf
 "Mayer 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.
> 
> The problem I get is that my "next" link - something like
> href='resultspage.php?page=2' - naturally reloads the page without all the
> POST variables it needs to recreate the query.
> 
> Is there some way of forcing the page to remember and reload the POST
> variables when clicking "next"? Or, if that's difficult, can anyone suggest
> a good way of addressing this problem without too much recoding? I'm sure
> there must be a neater way of doing it then simply passing 30 or so
> variables using GET.
> 
> Many thanks in advance.
> Jon.


Set session variables, have the script check the session variables.

That'll keep the pages rolling, shouldn't take much coding, and you can change 
some things on-the-fly.

HTH,
Wolf

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



Re: [PHP] Keeping POST values when paging

2008-07-07 Thread Eric Butera
On Mon, Jul 7, 2008 at 9:51 AM, Mayer, Jonathan <[EMAIL PROTECTED]> 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.
>
> The problem I get is that my "next" link - something like
> href='resultspage.php?page=2' - naturally reloads the page without all the
> POST variables it needs to recreate the query.
>
> Is there some way of forcing the page to remember and reload the POST
> variables when clicking "next"? Or, if that's difficult, can anyone suggest
> a good way of addressing this problem without too much recoding? I'm sure
> there must be a neater way of doing it then simply passing 30 or so
> variables using GET.
>
> Many thanks in advance.
> Jon.
>
> Jonathan Mayer
> Motion Capture Studio Manager
> TT Games (www.ttgames.com)
> Email: [EMAIL PROTECTED]
> Tel: 01565 757357 Mob: 07814 973885
> Address: Traveller's Tales, Canute Court, Toft Road, Knutsford, Cheshire,
> WA16 0NL
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Two semi-quick solutions:

1) Change your paging links to be inside a single form so that when
you click the button 3 it re-posts your hidden data fields with the
value 3

2) Persist your post data using session variables

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