Jump to content

create a php file like this forum does


xbl1

Recommended Posts

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

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

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

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

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
Hi 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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...