dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: How can I save filled forms in htm

  1. #1
    Join Date
    Aug 2008
    Posts
    1

    How can I save filled forms in htm

    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.

  2. #2
    Join Date
    Apr 2007
    Posts
    1,664
    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?

  3. #3
    Join Date
    May 2003
    Posts
    599
    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.

  4. #4
    Join Date
    Aug 2008
    Posts
    45
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles