What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP: refreshing a page with a button

PHP: refreshing a page with a button
Author: Message:
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. PHP: refreshing a page with a button
I need help with PHP since I'm not an expert in it.

So I have a form containing a table that goes to itself, and inside it there's a button that does some operation X.
What I want is, after the button's pushed, I want the page gets refreshed so the table content is updated.

What PHP code should I add near operation X?

I did google this, but all solutions I found were for auto-refreshing a page

Thanks.
Registered 7824 days, 23 hours, 59 minutes, 12 seconds ago.
Happy Birthday, WDZ

06-28-2006 09:01 PM
Profile PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: PHP: refreshing a page with a button
Do you mean how to redirect with php?

Send a location header like this:

code:
header("Location: page.php");

[Image: 1-0.png]
             
06-28-2006 09:40 PM
Profile PM Web Find Quote Report
Lou
Veteran Member
*****

Avatar

Posts: 2475
Reputation: 43
– / Male / Flag
Joined: Aug 2004
RE: PHP: refreshing a page with a button
quote:
Originally posted by Ezra
Do you mean how to redirect with php?
quote:
Originally posted by thekid
refreshing a page with a button

Althought that method works:)

Other method:
code:
header( 'refresh: 0; url=http://www.example.net' );

This post was edited on 06-28-2006 at 09:45 PM by Lou.
[Image: msghelp.net.png]
The future holds bright things in it\\\'s path, but only time will tell what they are and where they come from.
Messenger Stuff Forums
06-28-2006 09:41 PM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: PHP: refreshing a page with a button
Yeah, well... he has a button that does an operation, after that operation is finished just use the header to reload the page.
[Image: 1-0.png]
             
06-28-2006 09:44 PM
Profile PM Web Find Quote Report
Lou
Veteran Member
*****

Avatar

Posts: 2475
Reputation: 43
– / Male / Flag
Joined: Aug 2004
RE: PHP: refreshing a page with a button
quote:
Originally posted by Ezra
Yeah, well... he has a button that does an operation, after that operation is finished just use the header to reload the page.
Updated the post:P
[Image: msghelp.net.png]
The future holds bright things in it\\\'s path, but only time will tell what they are and where they come from.
Messenger Stuff Forums
06-28-2006 09:46 PM
Profile PM Web Find Quote Report
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. RE: PHP: refreshing a page with a button
I tried both methods and came up with some conclusion:
code:
if( $_POST['ok_btn'] == '1' )
    header( 'refresh: 0; url=http://www.example.net' );
I need to click the button twice to get "the refresh effect."
Can you explain this to me?
code:
if( $_POST['ok_btn'] == '1' )
    header("Location: page.php");
This has the closest result I want.

However, both methods don't really do "refresh" instead they redirect users to the URL in the link.
So, I click "Back" button on my browser, it goes to the page before the change was made.

I hope you understand what I mean :p
Thanks again.
Registered 7824 days, 23 hours, 59 minutes, 12 seconds ago.
Happy Birthday, WDZ

06-28-2006 10:35 PM
Profile PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: PHP: refreshing a page with a button
really refreshing isn't possible with php, try using javascript with xmlhttprequest for that, with the button first call the xmlhttprequest function to send the data to the server then edit the table with the new data received from the xmlhttprequest response data...

BTW: This doesn't even need a refresh ;-)

This JavaScript + XmlHttpRequest is better known as AJAX.

This post was edited on 06-28-2006 at 10:41 PM by Ezra.
[Image: 1-0.png]
             
06-28-2006 10:41 PM
Profile PM Web Find Quote Report
lizard.boy
Veteran Member
*****

Avatar

Posts: 1708
Reputation: 24
34 / Male / Flag
Joined: Mar 2003
RE: PHP: refreshing a page with a button
could you not just make a link that links back to the page?.. I suppose that wont properly refresh content in all cases. If it did work couldnt you just do it like This
If thats not what you mean, sorry, i misinterpreted the question.

This post was edited on 06-28-2006 at 11:50 PM by lizard.boy.
06-28-2006 11:49 PM
Profile E-Mail PM Find Quote Report
Jhrono
Veteran Member
*****


Posts: 1791
Reputation: 25
33 / Male / Flag
Joined: Jun 2004
RE: PHP: refreshing a page with a button
Nah, it probably wouldn't lizard.boy, because of the cache (am I right ?)
06-29-2006 12:05 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On