Copy current .php page with Values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
corin
Forum Newbie
Posts: 8
Joined: Mon Nov 04, 2002 3:07 am

Copy current .php page with Values

Post 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
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

DB

Post by AVATAr »

Why don't you use a Database and you regenerate de page to the user (you dont have to "cache" de page)..
corin
Forum Newbie
Posts: 8
Joined: Mon Nov 04, 2002 3:07 am

Post 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
Post Reply