j115 Posted October 10, 2008 Share Posted October 10, 2008 I need a PHP Script that makes a PHP file in a directory. I want the name of the php file to be the named by the contents of a text-box. I made a from and made it go to create.php Now on create.php I need to figure out how to make a php file and I need it to be called whatever the contents of the text-box name. Is this possible? If so, all help would be appreciated! Quote Link to comment Share on other sites More sharing options...
trq Posted October 10, 2008 Share Posted October 10, 2008 Take a look at fopen() & fwrite(). Quote Link to comment Share on other sites More sharing options...
j115 Posted October 10, 2008 Author Share Posted October 10, 2008 Take a look at fopen() & fwrite(). How do I actually create the file. That seemed to write to a file. But, I also need it to be writing a PHP File not a TXT File. Quote Link to comment Share on other sites More sharing options...
Archadian Posted October 10, 2008 Share Posted October 10, 2008 fwrite() will create the file if it does not exist in that directory and it will input the contents in that file for you. Quote Link to comment Share on other sites More sharing options...
tibberous Posted October 10, 2008 Share Posted October 10, 2008 `touch test.txt` Only works on Lindows, and other Lindows variants. Quote Link to comment Share on other sites More sharing options...
taith Posted October 10, 2008 Share Posted October 10, 2008 ? just write in the content into the data segment... it can handle any code... as long as it can be read when you save the file... you should be fine file_put_contents('yourphpfile.php','<?echo 'hello world';?>'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.