Refresh Page, Refresh after every 4 seconds continuously

Discussion in 'Programming' started by mohammad_x, May 24, 2007.

  1. #1
    Hi, I want to add a TextBox control to the page with a Button, when click
    button browser go to the URL that typed in TextBox open that page and
    refresh that after every 4 second.. and repeat continuously ...
    can any one help me how I can write this?
     
    mohammad_x, May 24, 2007 IP
  2. HuggyCT2

    HuggyCT2 Guest

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That could be done quite easily, you can use php and html for this.

    Something like this would work well.

    
    <form action="" name="redirect" method="post">
    <p>URL: <input type="text" name="url"/></p>
    <p><input type="submit" name="go" value="Go"/></p>
    </form>
    
    HTML:
    
    <?php
    
    if ($_POST['go'])
    {
    
    $url = $_POST['url'];
    
    echo "<meta http-equiv='refresh' content='4; url=$url'>";
    
    }
    
    
    PHP:
    I havent tested it but should work
     
    HuggyCT2, May 24, 2007 IP
  3. mohammad_x

    mohammad_x Peon

    Messages:
    127
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh, Can you tell me more about this?
     
    mohammad_x, May 25, 2007 IP
  4. HuggyCT2

    HuggyCT2 Guest

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What it does is takes the posted url from the form. Then in the php script if the submit button is pressed, it sets the value of the URL field to the var $var and then prints a html refresh command with the new url and the intervals set to 4 seconds.
     
    HuggyCT2, May 25, 2007 IP