Writing to an HTML document?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joetheeskimo5
Forum Commoner
Posts: 43
Joined: Sun Dec 14, 2003 4:47 pm
Location: US
Contact:

Writing to an HTML document?

Post by joetheeskimo5 »

This may seem like very basic stuff to you guys, but I'd like to know simply how to write to an HTML document. Basically, I'd like to take some text a user entered and to display it on a certain page. When they clicked "Submit", they would be re-directed to that page and see their submitted text displayed at the top of the page.

Thanks if you can help.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

you might want to read this Concerning Passing Variables in PHP 4.2+

Mark
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

You will have open the HTML file (or create one if it's not already created), write the text you want and then close it. Here are some functions that will help you out:

fopen -- Opens file or URL

fwrite -- Binary-safe file write

fclose -- Closes an open file pointer

Heres a tutorial that shows you how to use these functions:
http://www.somethingleet.com/forum/arti ... e&artid=63
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

i don't think he actually want to write a file, he just wants to display entered form information.

I think he just used the wrong wording.

Mark
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Ohhh, well just in case he wants to do it a much harder way he can write to the file then display it :wink:

Ignore my post, just read that link that Bech gave ya.
joetheeskimo5
Forum Commoner
Posts: 43
Joined: Sun Dec 14, 2003 4:47 pm
Location: US
Contact:

Post by joetheeskimo5 »

Thnx Bech, that helped a lot. :wink:

Joe
Post Reply