Being a relative newcomer to PHP, I hope I will be forgiven for asking for the answer to what I think is a very easy question!! I am trying to write a simple script that creates new pages on the fly and populates them with the contents of an include file that holds the standard layout for all pages (navigation, contents div etc).
The script will be getting the name of the new page via a $_REQUEST. I would like to know how you append the result with ".php" and store the result as $pagename; so, for example, the name for the new page is "books". The user submits the form, and the form handler gets the name "books" with the $_REQUEST['pagename'] bit. I then want the script to add ".php" to books, and store "books.php" as $pagename.
The code will then go on to check if that filename exists and, if it doesn't, will create it. It will then open the file "includes.inc" and copy the contents over to "books.php", thereby creating an entirely new, empty page on the fly... brilliant!
But how to I append ".php", and while you're at it, how do I copy the contents of "includes.inc" to $pagename??
Thanks in advance, as usual!!