|
-
Jul 28th, 2011, 09:34 AM
#1
Thread Starter
Hyperactive Member
Refresh or Reload page
Hi,
My question is how do i reload a php page after a job has been done.
Fore example my script does :
work 1
work 2
and after work 2 is finished i would like to reload the same xy.php page.
Can it be done ?
Cheers and Thanks!
Thanks for helping me out.
-
Jul 28th, 2011, 10:10 AM
#2
Addicted Member
Re: Refresh or Reload page
Hello
here is a simple way:
PHP Code:
<?php if ($_GET['job'] != 'done') { // work 1 // work 2 header('Location: xy.php?job=done'); exit(); } else { // do another thing } ?>
regards 
Feras Jobeir
Last edited by fjober; Jul 28th, 2011 at 10:14 AM.
-
Jul 28th, 2011, 10:18 AM
#3
Thread Starter
Hyperactive Member
Re: Refresh or Reload page
thank you very much!
i will try the code now ... 
EDIT:
this is what i have :
echo "<textarea rows=20 cols=40>" . $messageToShow."</textarea>";
die("Elaborated.");
$stop++;
header('Location: cronindex.php?');
exit();
But this seems not to work...maybe i did something wrong?
Last edited by batori; Jul 28th, 2011 at 10:46 AM.
Thanks for helping me out.
-
Jul 28th, 2011, 11:38 AM
#4
Addicted Member
Re: Refresh or Reload page
hello
- In my example, to know that we have done work1 and work2, I have passed a variable (job) with the value (done), in the URL.
- when you reload the page, all variable will be (cleaned from memory), you have to pass them via URL, store them in a session or database or any other way to work with them later
regards 
Feras Jobeir
-
Jul 28th, 2011, 11:55 AM
#5
Thread Starter
Hyperactive Member
Re: Refresh or Reload page
Is there a way to just reload the page ...
I have read that header function will not work is a text has been echoed before ....
Im really having trouble making this work ....
Thanks for helping me out.
-
Jul 28th, 2011, 12:12 PM
#6
Addicted Member
Re: Refresh or Reload page
Hello
so, instead of using header, try meta refresh like this
PHP Code:
echo '<meta http-equiv="refresh" content="0; URL=xy.php?job=done" />';
but it may be disabled, so try another way using javascript:
PHP Code:
echo '<script type="text/javascript">window.location="xy.php?job=done"</script>';
regards 
Feras Jobeir
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|