Re: [PHP] PHP Page Refresh on Redirection

2003-01-28 Thread Maxim Maletsky

make sure that new page's headers do not cache. See www.php.net/header
for examples.


--
Maxim Maletsky
[EMAIL PROTECTED]



"Phil" <[EMAIL PROTECTED]> wrote... :

> I have a PHP page with a form that submits to another PHP processing page.
> On completion of the PHP actions on the processing page, I have echoed into
> the page the javascript action of 'location.href=...' and the location is
> redirected to the PHP form page that starting the process. Both pages take
> data from an SQL server. The problem I'm having is that the the javascript
> always grabs the cached page. I need a newly refreshed page to return with
> updated data from the SQL server. Any suggestions?
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] PHP Page Refresh on Redirection

2003-01-27 Thread Justin French
on 28/01/03 4:42 PM, Phil ([EMAIL PROTECTED]) wrote:

> I have a PHP page with a form that submits to another PHP processing page.
> On completion of the PHP actions on the processing page, I have echoed into
> the page the javascript action of 'location.href=...' and the location is
> redirected to the PHP form page that starting the process. Both pages take
> data from an SQL server. The problem I'm having is that the the javascript
> always grabs the cached page. I need a newly refreshed page to return with
> updated data from the SQL server. Any suggestions?

In addition to sending the correct no-cache headers (which don't always work
with certain browsers and clients), you could also attach a random string to
the URL as a GET variable, so that the browser thinks it's a NEW, unread
URL.

include this function (straight from the manual) via a function library:


Then to get a random number,



Then you can echo it as a get var or querystring on any URL:

location.href = page.php?r=
location.href = page.php?


Justin


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




RE: [PHP] PHP Page Refresh on Redirection

2003-01-27 Thread John W. Holmes
> I have a PHP page with a form that submits to another PHP processing
page.
> On completion of the PHP actions on the processing page, I have echoed
> into
> the page the javascript action of 'location.href=...' and the location
is
> redirected to the PHP form page that starting the process. Both pages
take
> data from an SQL server. The problem I'm having is that the the
javascript
> always grabs the cached page. I need a newly refreshed page to return
with
> updated data from the SQL server. Any suggestions?

You may be able to use the header() function to send headers telling the
browser not to cache the page. Take a look at the header() manual page
and there is an example (6th gray box).

www.php.net/header

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP] PHP Page Refresh on Redirection

2003-01-27 Thread Phil
I have a PHP page with a form that submits to another PHP processing page.
On completion of the PHP actions on the processing page, I have echoed into
the page the javascript action of 'location.href=...' and the location is
redirected to the PHP form page that starting the process. Both pages take
data from an SQL server. The problem I'm having is that the the javascript
always grabs the cached page. I need a newly refreshed page to return with
updated data from the SQL server. Any suggestions?



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




RE: [PHP] Page Refresh

2002-04-23 Thread Crane, Christopher

That is my goal to only use only file and I do use a lot of IF statements.
I will try this. I have not used the Header() function. I will take a look
at it. If you have an example, that would be great.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 10:06 AM
To: Crane, Christopher
Subject: Re: [PHP] Page Refresh
Importance: High


i don't undertand why you have the meta refresh in there, but the porblem
you have is simular to any one who clicks refresh on their browser...

essentialy, what you want to do is after the DB insert, use a header()
redirect to a blank form -- steps might look like:

1. form.php (blank) [click submit]
2. validate.php
   a) if not ok redirect to form.php (with entered data)
   b) if ok, insert into DB & redirect to form.php (blank)

In other words, form.php doesn't actually print any data to the screen, it
just evaluates the entered data, and acts upon it.

The value of this is that if the user never sees validate.php, they can't
refresh it (or have a meta refresh), so the data can't be inserted more than
once via a refresh.

if they refresh the form.php, the DB will not be affected.


If you're cleaver with if() statements and other control structures, you can
actually achieve this effect with only one file (form.php)... but that's
another story :)


Have fun,

Justin French

Creative Director
http://Indent.com.au





on 23/04/02 11:47 PM, Crane, Christopher ([EMAIL PROTECTED]) wrote:

> I use a template page and then split out the middle of the page to do my
PHP
> stuff depending on a variable I pass to it.
> I have a problem I hope someone can help me on.
> The template page has a meta refresh in the header set for 60 secs. One of
> the things this page does is insert data into a MySQL database. The
problem
> is once it is finished it displays the same form used to enter the data in
> the MySql database for another record to be added if you wish...here comes
> the problem. After the first insert, the data form is redisplayed, but
after
> the 60 secs and the refresh takes place it runs the last insert again. If
> the user just leaves that page up, every 60 secs it will insert another
> record every 60 secs.
> 
> I was thinking there may be a mechanism to redirect to a different URL
after
> the database insert, but I do not know how to do that. I want to keep the
> meta refresh because there is a lot of dynamic data displayed on the
> template page that changes. Which is the reason for the Meta Refresh to
> begin with...
> 
> 
> 
> Christopher J. Crane
> Network Operations Manager
> 
> IKON Office Solutions
> 860.659.6464
> 
> 
> 

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




Re: [PHP] Page Refresh

2002-04-23 Thread esivertsen

You could use a SESSION variable called for instance 'SUBMIT_TO_DB'.
After submitting to the database, you simply set this variable 'SUBMIT_TO_DB' to 
'NO'... 
The next time the page is reloaded, you won't have to submit one more time to the 
database, provided you check whether 'SUBMIT_TO_DB' is 'NO'.
And opposite: if it is not set, you SHOULD do the submission to DB. 

My $0.02

Eivind



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




[PHP] Page Refresh

2002-04-23 Thread Crane, Christopher

I use a template page and then split out the middle of the page to do my PHP
stuff depending on a variable I pass to it.
I have a problem I hope someone can help me on.
The template page has a meta refresh in the header set for 60 secs. One of
the things this page does is insert data into a MySQL database. The problem
is once it is finished it displays the same form used to enter the data in
the MySql database for another record to be added if you wish...here comes
the problem. After the first insert, the data form is redisplayed, but after
the 60 secs and the refresh takes place it runs the last insert again. If
the user just leaves that page up, every 60 secs it will insert another
record every 60 secs. 
 
I was thinking there may be a mechanism to redirect to a different URL after
the database insert, but I do not know how to do that. I want to keep the
meta refresh because there is a lot of dynamic data displayed on the
template page that changes. Which is the reason for the Meta Refresh to
begin with...
 
 

Christopher J. Crane
Network Operations Manager

IKON Office Solutions
860.659.6464