Page does not refresh

J

jcwmtl

Hello all
I'm building a suite of free php applications to create virtual worlds.
My problem is i can't get my file to refresh. Can this be done with
javascript?
I would like to have the display and the form be on a single
page..unless this can be done with frames.

The sample application contains 2 files:
a)The php file (with input controls and the embedded world)
b)The embedded world (text file)

1. The php file accepts input from the user
2. The user hits Submit which creates the text file for the world
this works - the text file is created with changes. next the page
should refresh itself and show the world based on the user's input.

Right now steps 1 and 2 work perfectly in the sense that the text file
for the world does get created. however the page will still show the
older version of the text file.

To get the page to refresh properly, i have to hit the reload button on
the browser...this gives me the "this page can't be refreshed without
sending..." alert...but it then refreshes and shows the changes.

the code:
the code for the text file is irrelevant.
the code for the php file (just a snippet):

<html><head>
<title>SpotCoder</title>
</head>
<body>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>Spot Title: <input type="text" name="SpotTitle" size="20" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>

<?php
//variables
$spot_code = $_POST['SpotTitle'];
//open
$sc = fopen("myfile.3dml", "w");

// Write to 3dml text file
fwrite($sc, "<TITLE NAME=" . '"'. $spot_code .'"'. " />\n");

// Close file
fclose($sc);

?>

<div id="Mylayer" style="position:absolute; left:25px; top:130px;
width:626px; height:440px; z-index:2">
<embed TYPE="model/vnd.flatland.3dml" SRC="myfile.3dml"
PLUGINSPAGE="http://www.flatland.com/download_direct.html" HEIGHT="440"
WIDTH="626">
</div>
 
J

Janwillem Borleffs

Right now steps 1 and 2 work perfectly in the sense that the text file
for the world does get created. however the page will still show the
older version of the text file.

Try something like:

<embed TYPE="model/vnd.flatland.3dml"
SRC="myfile.3dml?<?php print time() ?>"

Appending the output from the time() function will make the value of the SRC
attribute unique each time the page is reloaded and should force your
browser to retrieve a fresh copy from the server.

JW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top