Click to See Complete Forum and Search --> : How can I save filled forms in htm


zallz
08-19-2008, 03:05 PM
Hi

I'm trying to save filled forms in htm.

I have a main.php that calls page1.php, page2.php and page3.php .
Then, I want to show the entire pages in my main.php.
The tricky part is that the information has to still be available after main.php has been saved as an htm AND no other file has been saved (stand alone).

I tryed execCommand(SelectAll | Copy | Paste) which works fine in the php but doesn't show up in the htm file.

Is it because the htm is trying to reexecute the javascript code (allthought it can't) as if it hadn't been executed before ?

Ideas in any language would be welcome (although this is a php forum).

Thank you.

SyCo
08-21-2008, 08:00 PM
Err... what?
save filled forms in htm
Save where? .htm is an HTML page you'll need a PHP page to save the form info to a file, database or email.
main.php that calls page1.php, page2.php and page3.php
calls how, is it including the other files or cURL posting to them or reidrecting to them or etc...
information has to still be available after main.php
Session, hidden inputs, write to file, store in database. lots of ways depends what you're doing.

I tryed execCommand(SelectAll | Copy | Paste) which works fine in the php but doesn't show up in the htm file.
A .htm wont execute a PHP command

Could you perhaps explain that again maybe with some code samples?

hastx
08-21-2008, 10:28 PM
when you submit your form, harvest the form data and use it to populate a $html variable. This would be the exact same html as your form, except with the _POST data instead of form inputs. Then you write that variable to a html file.

That gives you a permanent html file from the form... you can load that html file into an iframe on main.php for previewing if you like.

ibechane
08-21-2008, 11:02 PM
If you know how to retrieve the data with $_POST, you can use fwrite to write a file.

tizag- tutorial on handling files: http://www.tizag.com/phpT/files.php