I am a newb to PHP, not to HTML though. (First time ever trying PHP). I have a PHP page that will allow the user to input their name and then submit it. like a guestbook. but instead what I want it to do is either create a .txt file or .html file that always has a different name with their info.
alright:
user #1 types his name in the text box, presses submit and then the code creates 1.html with his info.
I assume that I will need some sort of permanent counter in it so that it will keep going to create #.html to accomodate for the number of guests that go there.
any help is welcome. including a slap back to reality.
php: html file creating
I'm a newb to css... just got here, and I'm searching around to learn some basics. But I see a PHP question, and I've been doing that for a year+ now. Let's see if I can help...
If you could use a database... MySQL or PostgreSQL... that would be most efficient, I would think. But since I don't know exactly why you want completely different HTML files for each entry, I can't say for sure.
You can use PHP to create files. If you're going to avoid using a database, you could create a .txt file that keeps track of what # you're up to. You'd just have to code for it to be deleted and rewritten with the incremented # each time.
If you haven't used the PHP manual online yet, that's a must:
http://www.php.net/manual/en/
The "Filesystem Functions" will give you what you need to write and read .txt files.
php: html file creating
I'd be tempted to say that each time you want to create a new one, you could get a directory listing using readdir()... count the number of files returned and create the new file with that value + 1.
That would be quicker for small directories, but hermie's idea would be a lot quicker once things get quite large.
php: html file creating
thanks guys. I asked around elsewhere too. they said MySQL wasn't necessary and they also pointed me to the manual, so I've been going through it for a while. One thing still bothers me. I can't find the web directory that I'm supposed to save my .php files in when I want to develop locally.