Write to text file
- From: jcwmtl@xxxxxxxxxxx
- Date: 26 May 2005 21:01:53 -0700
Hello
I'm a complete php noob and a non-programmer.
I would appreciate any help.
I have a form which takes user input. On submit, the form will run a
php script that will create a new text file using the user input.
I want this text file to popup or open in a new page. The problem is
that when the page opens it still shows the old text file, i need to
hit refresh for it to show the last user input.
the html file (greatly simplified):
<html><head>
<title>Untitled</title>
</head>
<body>
<form action="action.php" method="post">
<p>Title: <input type="text" name="Title" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
The php file (simplified as well):
<?php
$spot_code = $_POST['Title'];
// Open the file and erase the contents if any
$fp = fopen("myfile.3dml", "w");
fwrite($fp, "<TITLE NAME=" . '"'. $spot_code .'"'. " />\n");
fclose($fp);
//redirect
header( 'Location: http://localhost/mytest/myfile.html' );
?>
the text file, myfile.3dml is embedded in myfile.html (it requires a
plugin to view - it's a 3D world). When myfile.html is opened it
displays myfile.3dml but it needs to be refreshed to show the current
input.
how can i ensure the current input is displayed.
also, how would i make a popup appear rather than have myfile.html open
in a new page.
thanks
.
- Follow-Ups:
- Re: Write to text file
- From: Richard Quick
- Re: Write to text file
- From: askMe
- Re: Write to text file
- Prev by Date: Re: Will php ever do strong typing?
- Next by Date: Re: Write to text file
- Previous by thread: php is right tool for job?
- Next by thread: Re: Write to text file
- Index(es):
Relevant Pages
|
|