Output Buffering Question

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
smoky989
Forum Commoner
Posts: 41
Joined: Mon Sep 02, 2002 1:14 pm

Output Buffering Question

Post by smoky989 »

OK, here's the deal. I have a form that when the user hits the submit button a PHP page is called displaying the variables from the form where I want them on a page. It worls fine. What I would like to do is have the html generated by that PHP page emailed to me so I can upload the file for permanent use. I asked this question before and was told it can be doen using output buffering. I've looked at a few tutorials but could not find anything to solve by problem. If anyone could explain how I could do this it would be greatly appreciated. Thanks in Advance. Dave
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post by DaZZleD »

what you need to do is to create the entire page in one variable(let's say $display) then echo it to the browser(the user sees it) and use it as body for an email that you send to yourself. the email content type must be text only.

ofc you will have to take each email and copy the text there in a new .html file that you will afterwards upload. :wink:
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

you don't have to use a variable. php has a great set of functions for output buffering. take a look at the first comment here: http://www.php.net/manual/en/function.o ... ntents.php
he gives a brief but good example of how you can wrap your code with output buffering functions and get the contents later on into a variable.
Post Reply