3 replies [Last post]
nix
nix's picture
Offline
Enthusiast
(n): a position or site occupied or available for occupancy or marked by some distinguishing feature
Last seen: 11 years 46 weeks ago
(n): a position or site occupied or available for occupancy or marked by some distinguishing feature
Timezone: GMT-4
Joined: 2003-08-12
Posts: 159
Points: 0

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.

I refuse to be like the faceless masses of sheep and have a signatu......awwwwwwwww CRAP!!

Backups? Ha! I've never had troub**&{[}$$ERROR NO CARRIER

Tags:
hermie
Offline
newbie
LA, CA
Last seen: 16 years 42 weeks ago
LA, CA
Timezone: GMT-7
Joined: 2004-06-22
Posts: 2
Points: 0

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.

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 5 years 11 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

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.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

nix
nix's picture
Offline
Enthusiast
(n): a position or site occupied or available for occupancy or marked by some distinguishing feature
Last seen: 11 years 46 weeks ago
(n): a position or site occupied or available for occupancy or marked by some distinguishing feature
Timezone: GMT-4
Joined: 2003-08-12
Posts: 159
Points: 0

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.

I refuse to be like the faceless masses of sheep and have a signatu......awwwwwwwww CRAP!!

Backups? Ha! I've never had troub**&{[}$$ERROR NO CARRIER