
June 9th, 2000, 11:58 PM
|
|
Contributing User
|
|
Join Date: May 2000
Posts: 30
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
You can do this 1 of 2 ways. Either setup an entry in your database that is just a pointer to a text file that will be read. Or you could acutally include the entire textfile in the database entry.
Something like this might work (it is late here and writing code on the fly might not be the best thing for me right now)
<?
if($action == "Submit") {
readfile("your.form.txt");
//I assume you setup the database connection
//already
$query = "SELECT * FROM textfiles where (name = $textfile)";
$result = $mysql_query($query);
readfile($result);
}
else {
//display your form if no default varibles are set
readfile("your.form.txt");
?>
I don't know if I was clear enough up there, so write with any questions. Basically if the user hits the page it will display the else clause, thus displaying your form that will when submitted cause the $action varible (the name of your submit button would be action, value would be Submit) and the $textfile variables to be set either in with a post or get method for your form. When the form is submited, it querys for the textfile you want and then uses that it gets as a pointer to readfile it...or display it. It might not be that clean, but it is one way to do it. I would have made it cleaner if I wasn't about to go to sleep...
|