function to refresh a page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tedzz
    New Member
    • Jan 2008
    • 2

    function to refresh a page

    Hi guys
    I'm new in php, and i need a php function that allows the page to refresh while resending information the same information that was sent to it earlier. Does this function actually exist?
  • sandeepsandeep
    New Member
    • Dec 2006
    • 50

    #2
    U can use the header() in php function pass the location in header if u redirect the same page call the same url..

    There are another way in html there are <meta> tag set the refresh time and refresh the page every time how thet u set the time in milisec.

    Sandeep Agrawal

    Comment

    • tedzz
      New Member
      • Jan 2008
      • 2

      #3
      Originally posted by sandeepsandeep
      U can use the header() in php function pass the location in header if u redirect the same page call the same url..

      There are another way in html there are <meta> tag set the refresh time and refresh the page every time how thet u set the time in milisec.

      Sandeep Agrawal

      I tried the header function... the problem is that it is not resending the same information..wh en the page refreshes all the submitted information is lost

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by tedzz
        I tried the header function... the problem is that it is not resending the same information..wh en the page refreshes all the submitted information is lost
        Either, send the data through the url:
        [php]
        header("Locatio n: http://example.com/?var=something& var2=something-else
        [/php]

        Then use $_GET to retrieve it:
        [php]
        $_var = $_GET['var']'
        $_var2 = $_GET['var2'];
        [/php]

        OR! You could have hidden input fields (in a form), which you have populated with the data, then use javascripts setInterval() to submit the form after a period of time.
        [code=javascript]
        document.form_n ame.submit()
        [/code]
        :)

        Comment

        • dlite922
          Recognized Expert Top Contributor
          • Dec 2007
          • 1586

          #5
          Originally posted by markusn00b
          Either, send the data through the url:
          [php]
          header("Locatio n: http://example.com/?var=something& var2=something-else
          [/php]

          Then use $_GET to retrieve it:
          [php]
          $_var = $_GET['var']'
          $_var2 = $_GET['var2'];
          [/php]

          OR! You could have hidden input fields (in a form), which you have populated with the data, then use javascripts setInterval() to submit the form after a period of time.
          [code=javascript]
          document.form_n ame.submit()
          [/code]
          :)
          basically you just want to hit the refresh button, this has nothing to do with PHP as it is on the client side, create a link for the page itself or the following will work too:

          Code:
            
          <a href="JavaScript:location.reload(true);">
          Refresh this page
          </a>
          header() is used when redirecting from the server.

          Comment

          Working...