I am making a tic tac toe script where one player can play against another, and is there a way that when someone makes a move it automatically refreshes the other person's computer?

    soz i cant help but ive been wondering the same thing, so ill b watching this one just too see if it is possible 🙂

      No; the server can't make the client refresh a page (especially not a completely different client from the one making the a request). Instead, if you want a page to refresh itself, you have to put a request for the client to do that at some time in the future when you serve the page up to them. You basically have to pick an appropriate time interval and have the page re-request itself periodically, say every 10 seconds.

      A Refresh: header or a <META> refresh tag in the page that is to refresh itself could achieve this. But PHP can't tell the client to do anything.

        Hmm, I have an idea that might work. Have both pages refresh after 10 seconds. If the player's whose move it is doesnt go in the 10 seconds, it skips their turn.

          a month later

          I also am making a PHP based multi player tic tac toe game, and found a way to automatically submit. I used JavaScript to call a function in JavaScript to submit the page.
          Here is the code:

          This is for calling the JavaScript function from PHP (sould go on the top of the page in the HTML)....

          <script language="JavaScript" type="text/JavaScript">
          <!--
          function MM_callJS(jsStr) { //v2.0
          return eval(jsStr)
          }
          //-->
          </script>

          The code below uses the code above to call the JavaScript Submit function....(this should go in the PHP)

          //Auto Submit the form
          ?><body onLoad="MM_callJS('auto()')"><?php

          This code is the JavaScript Function that submits the page... (sould go above the form, and dont forget to change the "form_name" to the name of your form)

          <script language="javascript">
          function auto(){
          document.form_name.submit();
          }
          </script>

          Hope This Helps.....
          If you want to see my multi player TTT program just say so here... and I will post the link.

          Evan Mjelde
          evan18h@yahoo.com

            weed and all,
            to reduce the load to be reloaded each reload, what do you suggest ?
            how to make sure the client cashing allowing just what's changed reload ?

              Write a Reply...