Re: creating HTML page on-the-fly
| From: | Michael Teter | Date: | Tue, 04 Jul 2000 18:12:53 +0000 |
| Subject: | Re: creating HTML page on-the-fly | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4788@lists.php.net to get a copy of this message | ||
perhaps I don't understand the problem, but I don't
see why you're bothering to write a file.
all you need to do is have your .html page --
stepOne.html -- (the one with the form and submit
button) call a php page -- stepTwo.php.
stepTwo.php can dynamically generate content based on
variables that were set in the form from stepOne.html.
this should be really straightforward, and in fact for
the simplest case you don't even need sessions.
eventually you'll need sessions, but don't start
simple.
this should be very similar to how you would do the
same thing in ASP.
michael
--- "Thomas Edison Jr." <thomasedisonjr@yahoo.com>
wrote:
> What is the name of the file? is it a .php3 or a
> .html
> ? where is this file stored???
>
> T. Edison jr.
>
> --- Daniel Gustafsson <cloaked@hem.passagen.se>
> wrote:
> > At 05:11 AM 7/4/00 -0700, you wrote:
> > >How do u generate an HTML file on-the-fly using
> > PHP?
> > >I'm making a greeting cards site and i'm storing
> > >values in sessions. I want to generate a page
> > >automatically when the user hits the submit
> button
> > >which will contain his choice of the card
> elements
> > >which have been stored in session variables.
> Also,
> > at
> > >the same time a link to the page will be sent by
> > >email.
> >
> > I'm not sure exactly what you mean, since the
> basic
> > purpose of PHP is
> > generating HTML on the fly ;)
> >
> > But I'm guessing what you are trying to do is to
> > output everything into a
> > static file. I myself had been pondering about
> this
> > until I saw a posting
> > to this list some time ago.
> >
> > If you're using PHP4 you can utilize the output
> > buffering. Turning the
> > output-buffering on (using ob_start), outputting
> > everything like you would
> > normally do, and then storing the output in a
> > variable (using
> > ob_get_contents) and outputting it to a file =)
> >
> >
> > ---8<---
> > <?
> > ob_start();
> > ?>
> > <html>
> > <head><title>Cool Card</title></head>
> > <body>
> > To: <?=$receiver?><br>
> > <img src='<?=$cardimage?>'><br>
> > <?
> > // yada, yada....
> > ?>
> > </body>
> > </html>
> > <?
> > $data = ob_get_contents();
> > ob_end_clean();
> > // ... write $data to a file
> > ?>
> > ---8<---
> >
> > This should probably do the trick, you might want
> to
> > perform a flush()
> > before the ob_start() if you have output buffering
> > enabled by default.
> >
> > This is _really_ a handy feature of PHP4, saves
> you
> > alot of keyboard
> > bashing =)
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail:
> > php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : abraxastech@yahoo.com
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/