-2

I used the function header() in a code block to refresh the page after the user writes and submits an input. The code stores the inputs in variables and then refreshes the page. When I ran it the page refreshed but gave a white blank page with no o/p at all

Here's the refreshment code

header("refresh:0");
exit();

Any help?

3 Answers3

2

I think this is the correct code. To redirect to same page,

header( "Refresh:0"); 

To redirect to another page,

header("Refresh:0; url=yourPage.php");
jimmypage
  • 656
  • 5
  • 17
0

If you want to redirect user to same page you could simply use

header("Location: yourfile.php");
Gaurav Rai
  • 900
  • 10
  • 23
0

I've found 2 Ways to refresh a PHP content :

1.Using HTML META :

echo("<meta http-equiv='refresh' content='1'>"); //Refresh by HTTP META

2.Using PHP REFRESH RATE :

//Where 0 is an example of time Delay you can use 5 for 5 seconds for example !
$delay=0; 
header("Refresh: $delay; url=yourURL.php"); 
San Ka Ran
  • 156
  • 2
  • 18