xbl1 Posted July 9, 2007 Share Posted July 9, 2007 Hi;I'd like to create a php file after a user submit a thread. For example, i post this thread with the title of "create a php file like this forum does",then i want to create a php file with a name of "create-a-php-file- like-this-forum-does.php".Could anyone tell me how i can do this, please.I tried to create a php file as following, but it does not work. <?phperror_reporting(e_all);$myFile="create-a-php-file- like-this-forum-does";$e=".php";$myFile="$myFile$e";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = "<html>welcome to mypage, I am testing</html>";fwrite($fh, $stringData);fclose($fh);?> Link to comment Share on other sites More sharing options...
xbl1 Posted July 9, 2007 Author Share Posted July 9, 2007 Hi;I'd like to create a php file after a user submit a thread. For example, i post this thread with the title of "create a php file like this forum does",then i want to create a php file with a name of "create-a-php-file- like-this-forum-does.php".Could anyone tell me how i can do this, please.I tried to create a php file as following, but it does not work.<?phperror_reporting(e_all);$myFile="create-a-php-file- like-this-forum-does";$e=".php";$myFile="$myFile$e";$fh = fopen($myFile, 'w') or die("can't open file");$stringData = "<html>welcome to mypage, I am testing</html>";fwrite($fh, $stringData);fclose($fh);?> Link to comment Share on other sites More sharing options...
smartalco Posted July 9, 2007 Share Posted July 9, 2007 it doesn't create another php file, there are various parts of the index.php script that take info supplied by the url (the '?showtopic=14101') and uses that to display the appropriate content after searching a database (mysql or the like), if you were to look at the file tree for this site there would be very few files, not several thousand as would be needed to display every single topic on its own page Link to comment Share on other sites More sharing options...
justsomeguy Posted July 9, 2007 Share Posted July 9, 2007 The web server uses a technique called URL rewriting to load the index.php page regardless of what the URL in the address bar says. The reason the address bar contains those words is for search engines. Link to comment Share on other sites More sharing options...
xbl1 Posted July 10, 2007 Author Share Posted July 10, 2007 Hi smartalco && justsomeguy;Thanks for your reply, let me take some time try to understand what you said, then i will come back to you. Link to comment Share on other sites More sharing options...
xbl1 Posted July 10, 2007 Author Share Posted July 10, 2007 it doesn't create another php file, there are various parts of the index.php script that take info supplied by the url (the '?showtopic=14101') and uses that to display the appropriate content after searching a database (mysql or the like), if you were to look at the file tree for this site there would be very few files, not several thousand as would be needed to display every single topic on its own pageHi smartalco;Thanks for your reply, let me take some time try to understand what you said, then i will come back to you. Link to comment Share on other sites More sharing options...
xbl1 Posted July 10, 2007 Author Share Posted July 10, 2007 The web server uses a technique called URL rewriting to load the index.php page regardless of what the URL in the address bar says. The reason the address bar contains those words is for search engines.Hi justsomeguy;Thanks for your reply, let me take some time try to understand what you said, then i will come back to you. Link to comment Share on other sites More sharing options...
smartalco Posted July 10, 2007 Share Posted July 10, 2007 another thing you might want to catch on to, this isn't a bunch of pm's (personal messages), this is a forum, we can all read your posts, the 3x thanks wasn't necessary Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.