Page 1 of 1

Copy current .php page with Values

Posted: Tue Nov 05, 2002 6:11 pm
by corin
I have a dynamically created .php file containing user input text and an uploaded .jpg file, called newpage.php. I want to make a copy of this file in a temp directory so the user can view their personal page at a later date. Problem is when I open the copied file all the previously input values are missing of course and replaced with default ones. So my question is what is the best way for me to make a copy of the current page, but to also send the global values as a permanent fixture in the new copy too. My copy line so far is

<?php copy("/home/mydomain/public_html/$PHP_SELF", "/home/mydomain/public_html/temp_files/test.php"); ?>

The newpage.php is opened by a form method POST, with values such as firstname, lastname, picture.jpg. These are the values I'd like to send to the copy test.php but as static values. Hope somebody can :? point me in the right direction. Thanks

DB

Posted: Tue Nov 05, 2002 6:57 pm
by AVATAr
Why don't you use a Database and you regenerate de page to the user (you dont have to "cache" de page)..

Posted: Tue Nov 05, 2002 10:22 pm
by corin
Yes, I've been dabbling with SQL as I prefer this option too. So far I can add the data eg $firsname $lastname to a table no problem. I'd still like to have a unique url for the users page, again no problem. My task now is to figure out how to select the row (primary key) of previously input data that relates to the specific page at hand. I'm thinking of using DATETIME eg $datetime = date("Y-m-d H:i:s"); This will give me a unique field to search for. Perhaps I could use this same field as the $newpage.php filename and do a search in the database for a field that matched the $newpage name. If you understand what I'm saying - Is this a fair way to do this, or is there a simpler way? Thanks