Backing Up User Forms As Static HTML

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Backing Up User Forms As Static HTML

minnieadkins
System: Activity System for use in Universities

Users: Faculty members

Scenario:

User fills out a list of activites they participated in. Example: A faculty member attended a seminar about Object Orientated Programming. They record that seminar into their records by filling out a form and adding that activity into the database and identifying it with a designed term id. Spring terms are different than fall terms etc etc.

We want to create html snapshots of these forms that can be included by a simple
include('oldForm.html') into another form for review.

We want to be able to include multiple files into the same page as well. In other words, we will be able to look at multiple "old" forms at the same time.

I'm curious on how people would attempt to solve this problem.

Below is sort of a simple diagram of what happens in order. We want to create the snapshot at step # 4.

1.) Administrator informs everyone to fill out their forums
2.) Faculty member fills out DYNAMIC form, and submits it for review
3.) Administrator reviews form and decides to reject or accept
4.) If accepted- snapshot is recorded of the Faculty members form

In order to build these dynamic forms we have lots of include files for different sections. IE

We have files for all the different activities:
Scholarly
Service
Committees
Development


How can I capture the content of all this and dump it to a html file? Is there anyway to do this?

One way I found would be to use a URL to rebuild the form when it's time to make a copy, in the file_get_contents() method (as well as fget i believe). The only problem with this is each user has to login to use the system, so when I use that method and pass a url I just capture the login screen.

I'm sure I'll need to clarify some things before there's a good answer, or you actually understand my problem.


I hope someone can help, or offer advice.

 

 

 


Reply

Arbitrary
QUOTE

1.) Administrator informs everyone to fill out their forums
2.) Faculty member fills out DYNAMIC form, and submits it for review
3.) Administrator reviews form and decides to reject or accept
4.) If accepted- snapshot is recorded of the Faculty members form

1. A form is set up.
2. The form information is stored in a table that stores all forms. One column in the table should tell if the form is approved or not. (Perhaps a boolean value)
3. The administrator, in a different form, approves the content. The column that tells if the form is approved or not should be changed to true or 1.
4. To create the snapshot:
First you'd retrieve the title from the title column in the table.

CODE
<?php
        $a = mysql_query("SELECT * FROM table_name WHERE id='$id'");
        $numrows = mysql_numrows($a);
        for($i=0; $i<numrows; i++){
                $title = mysql_result($a,$i,"title");
                $content = mysql_result($a,$i,"content");
        }
?>

<?php
        $ftitle = str_replace(" ", "-", $title); //replace spaces in the title with a hyphen
        $f  =  fopen($ftitle.".html",  'w+'); //open the file. Since the file probably does not exist, it will create a new file.
        $html =  "<html><head><title>$title</title></head>$content</html>"; //the html to insert into the file

        fwrite($a,  $html);

        fclose($a);
?>


Ermm...I think the last part was what you were looking for, no? I didn't realize until a bit later. Stupid me! XP

Notice from vizskywalker:
Be sure to put your code in code tags

 

 

 


Reply

minnieadkins
Thanks for the reply, but it's not exactly what I was looking for. I'm looking for a way to take the already html that exists in the document and save it to a file. The problem is the include files we have in place just prints html out and builds the form for us. Now lets say we want to capture that data while it builds it. Is there a way to do it?

I've been playing around with file_get_contents($URL); but it's turning out to be a lot of trouble. I'm trying to pass the session data because I can't keep the same session open or something.

Maybe someone could help me with that instead. How (when logged into a system) can I use file_get_contents and use the same session/session variables to retrieve a new file. I ended up passing the session variables in a query string then undecoding them once I got it over there. However it's still not functional. Some strange things happening, but overrall I receieved my variables and rebuilt my superglobal $_SESSION variable.

I tried to simply pass the session id and then change my session id, but it didn't work too well either.

Very confusing.

Reply

minnieadkins
I think something like this would help with my problem.

QUOTE("SAWymer")
ob_start();

Then, at the bottom of your page, do

$contents = ob_get_contents();
file_put_contents('data.html', $contents);
ob_end_clean();

Reply

vujsa
QUOTE(minnieadkins @ Jan 22 2007, 10:00 AM) *

I think something like this would help with my problem.

Let me see If I understand what you are talking about.
  1. Admin says fill out your activity forms.
  2. Faculty member fills out a dynamically generated HTML form and submits it.
  3. A handler script takes the submitted form data and saves it to some type of database.
  4. The administrator reviews the activity reports which are dynamically generated HTML forms that are dynamically filled in with the data from the database.
  5. If the administrator accepts the report, a snapshot of the pre-filled form is saved as a Static HTML file.

If this is what you want to do then the object handler option you mentioned is the way to go! It should be in the script from step 4. This should save the file to a temporary directory. When the administrator "Approves" the report, then a second script should move the file to the permanant directory.

You would have to code a method of prunning older / unapproved reports. You'll have to carefully design a system of naming the files to ensure that you can find the right file at a later time.

Of course, this is going to use up a lot of diskspace since you are saving so much information. The form information is going to be much larger than the actual data information. Just seems strange to want to resave data that is already in a database.

Try to code your object buffer to include as little HTML as possible outside of the form to save space and time.

Hope this helps,
vujsa

Reply

minnieadkins
Yes vujsa you are correct. I find it a bit strange too to save data as html than just pull from the database, but there are underlying reasons.

1.) Hard drives now days cost a lot less.
2.) Rather than wasting server resources on pulling from the database we could include an html file
3.)The forms are dynamically generated, and the display of the forms can be altered...with that being said, the structure of the form would require more database entries to retain the past structures of the forms. It's much easier to simply dump the past forms than repulling everytime.

Yes I do have a naming scheme in order to make sure every form is uniquely named with a purpose. Not to mention we're going to gzip the file. Rather than hold all of that in the database we're just going to file it away.

I like your idea of doing the temporary file, but I'm doing an entirely seperate pull to write the file itself. This seperate pull basically cuts down on all the html it has to write, and is kept in a function, so we can use it anytime we want to backup that particular form. If we ever need it that is. A temp file is a good idea. I like that. Would save on database resources, it would just use server resources to strip the html of any characters we don't need.

Thanks for the advice,

-Brad

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : backing, user, forms, static, html

  1. How To Enable User Login Security On Windows Vista
    NOT User Account Control (0)
  2. How To Change Your Windows User Environment Variables
    a step-by-step guideline (5)
    1. INTRODUCTION. Most of Microsoft very basic users are satisfied when the Windows installer
    installs each new software, automatically putting each file in the right place and making each
    Windows registry change. However, some new incoming software environment, mainly the ones from the
    open world, let you do some changes manually. For instance, if you install the java development
    software on your pc, you have to manually tell windows where the java binaries are. That means, if
    you type “javac” in a command shell window, Microsoft Windows has to know that javac.ex....
  3. Good Books For Html And Css Beginners
    (1)
    Hi all, Know any good books or tutorials for beginners? I've been using Site points learn
    "Build your website the right way using HTML and CSS and can't recommend it enough. It's
    completely XHTML compliant and is a great starting point? Seen anything else useful? I'd be v
    interested in finding out about Javascript for beginners type things. Thanks, ....
  4. Basic Html Tutorial
    Made it myself, hope you like it. (1)
    HTML stands for hyper text markup language. It is a basic coding language used on almost every
    website. There are some tags in HTML which must be used, whilst others are enhancing, but not
    essential. Below I shall list the essential tags and there uses: This tells the browser that
    the language between the tags is going to be HTML so it knows how to read it. Inbetween those tags
    come These tags tell the browser that all the content that you wish to be displayed is in there.
    They are the only essential tags for HTML! The list is short but if you only use them your ....
  5. [c/c++][linux] Linking With A -l Is Static Or Dynamic?
    How will it effect distribution and portability? (0)
    It has been a long time since I coded in C/C++ and I can't seem to remember the exact mechanism
    of linking. Say, I compiled and linked the source code given at SQLite quickstart guide (C
    example in Write Programs That Use SQLite ) in Linux(Ubuntu) environment: g++ -o"SQLiteTest"
    ./sqlitetest.o -lsqlite3 It gives me a nice executable SQLiteTest and I can use it on my
    system. But how would it fare when I distribute that code to someone else? Is the libsqlite3.*
    statically packaged into SQLiteTest? or is it dynamically linked and the recipient of the prog....
  6. What You Need Before You Can Create A Text-based Game..
    Using PHP, HTML and MySQL (7)
    Please comment and rate, after you finished reading! /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" />
    ################################################################# Change log: Aug 22 2008: The
    Tutorial Was Created. V1.0.0 Aug 30 2008: Added XHTML and a small CSS part. Also corrected some
    small things and added this change log. V2.0.0
    ################################################################# OK.. Many people here want to
    create text based games. Many of you ask us here on the forums: "how to create a text-based game....
  7. User Account Control
    (13)
    I'm sure most of you know about Windows Vista's User Account Control. I was wondering if
    there were any registry settings or anything that I could modify to force the UAC prompt to appear
    when doing these tasks: Clicking the Start button Opening any folder Launching any application
    Adjusting personalization settings Opening a new page in Internet Explorer (by that I mean typing
    in a URL, from Favourites or by clicking a link) Turning off, sleep or restarting the computer
    Modifying the Windows Sidebar Opening any file (mp3, document, anything) There's....
  8. Joomla Template Kit Extension For Nvu/composer
    help in understanding how to change html template to joomla (3)
    Hi Everyone, I am becoming quite (a lot) interested in designing with joomla, and need an
    understanding of how to use the template kit extension in Nvu/Composer. There doesn't appear to
    be any tutorials available on how to use a HTML template to insert and design with joomla modules.
    Is there anyone who could shed some light on this subject. It would be MUCH appreciated.....
  9. Indentation In Html
    (4)
    Whenever I start a new project one of the first things I do is put in a base index.php page. Yes,
    it's a .php file, but I won't be looking at the PHP just yet. Normally, it looks a little
    something like this: CODE               Title                                    
                   I've already got a few basics set out that I tend to stick to. For
    instance, so far each of my projects has been XHTML Strict, which is why it's always up there.
    Similarly, I use the same character set, and (at least initially) have two CSS files calle....
  10. Yahoo! Messenger Power User
    (2)
    I just received a very weird message when I logged into Messenger today. It said “Congratulations,
    you are a Power User!” The pop-up was in its separate window similar to the annoying Insider and
    had a Learn More, Choose Your Icon, and No Thanks button (the Learn More button didn’t work). After
    doing a quick Google search
    (http://help.yahoo.com/l/us/yahoo/messenger/messenger9/pwrusr/pwrusr-01.html)
    (http://messenger.yahoo.com/powerusers) I found that this thing does really exist and wasn’t some ad
    pop-up that somehow got past my defenses. Here are a few of the “benef....
  11. Web Editor
    great application for your html and javascript development (0)
    Aptana IDE is a free Integrate Development Environment great for HTML/CSS editing and Javascript
    development The best feature in my opinion is the autocomplete feature , both in html and css mode
    it not only give you the suggestion but informs you about compatibility in different browsers and
    vresions same in javascript mode It is based on Eclipse IDE, it's free and can be extended
    help you with your php editing need to it's free and defenitely worth a try LINK ....
  12. How To: Display A Members/user List.
    With PHP, Mysql, and HTML. (3)
    Alright, some of you might want to display your User's or Members on your site. Notes: 1.This
    is to fit in with Feelay's register and Log-in scripts you can find in the tutorial section. 2.I
    made this to show the members of my site who is a member and what their ID is. First off, we must
    set up a connection to our MySQL Database. CODE $con =
    mysql_connect("localhost","database_username","database_username_password"); if (!$con)   {
      die('Could not connect: ' . mysql_error());   } What it does: 1.It is starting a PHP
    document. 2.Next it sets....
  13. Mysql And User File_priv
    (0)
    HI, I've hit the grain while trying to import file to mysql database - I need to enable file
    permissions of the database user but this seems not possible with most of the hosting providers.
    The problem is to set file_priv of the database user to "Y" . This is done in the "user" table of
    the maintanance database named "mysql". cPanel doesn't allow this. Via the cPanel you can only
    allow privileges on table querries but you cannot grant host file privileges to the database user -
    which makes querries like: "LOAD DATA INFILE 'filename' INTO TABLE tablen....
  14. Style P And H? Html Tags
    (2)
    Well, I have found that css was very hard to predict and precise control their apperance. When mix
    and use the p and h? tags. Their apperaence were not identity. Place the h? tags within the p tag
    causes style error on both firefox and IE. So, anyone should do it reserved, instead, place the p
    tag with any h? tags will do the jobs on both browsers. Still learning it coz it much varies when
    doing styles. Tested it on XHTML 1.0 Strict....
  15. How To Create A "user Profile" Page.
    No design (easy to add later if you want). (14)
    Hi! It was a long time ago I created a tutorial, so I've decided to create a new one
    /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> This time, I am
    going to teach you, how to create a "user profile page". Lets say I am logged in on my account, and
    want to view someone else account information (in this case, only his username, but you can add more
    things later). Then I'll press on a link, that will take me to his user profile. But before
    you can do that, you will have to create a register script, and a login script. If you d....
  16. Yaml - (x)html/css Framework
    (2)
    The YAML (Yet Another Multicolumn Layout) Framework is an excellent open source project that helps
    you to create two or three columns (X)HTML/CSS floated layouts. This framework is very easy to use
    and allows you to modifiy it to your own needs, this framework offers some tools for rapid
    development of modern and accessible CSS layouts. QUOTE Yet Another Multicolumn Layout (YAML)
    is an (X)HTML/CSS framework for creating modern and flexible floated layouts. The structure is
    extremely versatile in its programming and absolutely accessible for end users. Based on w....
  17. Increase Your Knowledge Of Html Language
    (11)
    For Creating good website you have to be master in HTML Language. It is a scryptic Language. If you
    want to Learn this language than visit the link http://zwqa.page.tl/Increase-you-HTML-Knowledge.htm
    ....
  18. How To Create/edit/delete Ftp Accounts With Php
    Help me to create one php page to create FTP user accounts in Unix Ser (2)
    Thanks /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> ....
  19. Html Basic Tutorial
    <!-- For beginners only --> (9)
    Knowledge HTML stands for H yper T ext M arkup L anguage. You cannot create an HTML file
    using a rich-text editor, such as Microsoft Word or Wordpad. HTML To write a basic HTML, you will
    need to start with this: CODE The html > tag tells the browser that this is an HTML page.
    To close any tag, the same tag will be repeted but with the "/" sign. For example, CODE   
         Page title    Did you notice the /title >, /head > & /html > tags? That's how we
    close the tag. The HEAD > Tag A head > tag will include the meta >, titl....
  20. Graphcal User Interfaces In Java
    How do you make them? (4)
    Ok, right now I am currently using eclipse, however I can change to whatever if there is something
    else that would be better for this. But I have made a number of java applications, but they all
    simply use the command line for doing their user input and output. However, I have been interested
    in learning how to program graphical user interfaces in java, and was wondering if somebody could
    point me in the right direction, with some easy to understand and follow tutorials. Also, once I
    have done that, what about making a java program that can be easily executed? (I know t....
  21. How Do I Create Static Routes In Windows Xp?
    (11)
    Here's my setup: My PC connects to my Internet facing wireless router via a USB-pluggable
    wireless NIC, the IP address of which is 192.168.1.2 (netmask 255.255.255.0). The IP address of my
    router's LAN port is 192.168.1.1. The NIC which is embedded in the motherboard has remained
    disabled so far. Everything works OK, but I recently got a hold of a crossover cable, and I started
    using it to connect a laptop to my PC. So I enabled the embedded NIC on the PC and gave it an IP
    address of 192.168.2.2 (netmask 255.255.255.0, default gateway 192.168.2.2). The laptop&....
  22. Converting PSD To HTML
    (11)
    Hi I m new to this site. I have designed a layout in PSD. What i want is to know how can I slice
    the PSD to build a Cross-Browser Compatible HTML file. Thank U.....
  23. How Can I Make Xp User Autologin ?
    I know how to make the Administrator user automatically log in in Wind (6)
    I would like my system to automatically log the user Administrator at power-up or at system reboot.
    And I don't want to remove the Administrator user password. I knew how to do this with Windows
    2000 : in the command prompt, type "control userpasswords" and you see the user admin pannel coming
    up, you uncheck "user must provide a password", the system asks you the default user passwords and
    then you don't need to give the password again at each boot. How do you perform this under
    Windows XP ? I would not like to directly edit the registry settings, I would like t....
  24. New Features In Visual Studio 2005 Windows Forms
    (1)
    i dunno if all of u are by now well versed with the new exciting features in visual studio 2005
    forms, but for me this article was enlightening. for the benifit of others who wre in the dark like
    me.... New Features in Visual Studio 2005 Windows Forms QUOTE The little voice in my head
    shouted "Don't do it! Don't do it!" as I contemplated using the worn out cliché "Good things
    come to those who wait" to describe the experience of designing Windows applications with Visual
    Studio 2005. However, that cliché accurately communicates the idea that building Wi....
  25. Get User Input From Vbscript For Batch Files
    Get user input from vbscript (2)
    Hello, I didn't see a tutorial on this subject so i'll go ahead and do it. Long ago I used
    batch file programming a quite a bit. I used vbscript files to get user input for the batch files.
    So here is a simple example of using the 'call' command to call for the vbscript file which
    should be in the same folder as the .bat file. in the batch file pretty much anywhere you can start
    the vbscript, and call another .bat file- using @ to of course not echo the line of code - CODE
    @ start /w wscript.exe userin.vbs @ call ~anyname.bat @ del ~anyname.bat....
  26. Laptop Hangs When Loading User (xp)
    My laptop is hangin when it is loading (6)
    When ever i turn my laptop on it hangs after i put in my User password /mad.gif' border='0'
    style='vertical-align:middle' alt='mad.gif' /> I have not changed anything.. How can i solve this
    problem (Formating now) Bu please tell for for further instructions /smile.gif' border='0'
    style='vertical-align:middle' alt='smile.gif' /> /smile.gif' border='0'
    style='vertical-align:middle' alt='smile.gif' /> Other words if its happens again... HELP!!!....
  27. Switching Forms - VB.NET
    Some VB.NET Basics (2)
    When I started coding in VB.NET I was unsure of how to switch forms at a click of a button or any
    other event. So for anyone with the same problem this is for them. First you must have at least two
    forms in the project. If you do not know how to add forms to a project heres how: 1) Under the
    "Project" Menu select "Add Windows Form..." 2) In the dialog box that pops up near the bottom you
    will see "Name:" with a textbox beside it. In the text box type the name of the new form. For this
    example we will just use the default name, "Form2.vb" 3) Click "Open" You now have....
  28. Secret Behind Your Nick/User Names
    Where did they come from? (128)
    The origin of my nick is actually a long story that some of you might not even understand. Anyway
    here it goes: I'm a Chinese from Hong Kong, and while my parents were in Taiwan, I was born.
    They use Chinese there too, but their transcription of my name into English to put on my uh... ID?
    that card that signifies my identity... I don't think that it's used in the US. Well, they
    called me Szu Chen Lo, but actually sounds like See Ching Law in my language. 9 years later, on a
    Friday after a testing week which lets us out of school early, as I discovered the Li....
  29. Converting HTML over to XHTML
    Crossing over to the darkside (13)
    Allow for alterations Well, I've just had to convert another HTML 4.01 Transitional website
    over to XHTML (eXtensible HyperText Markup Language) 1.0 Transitional, I will later on convert over
    to XHTML 1.0 Strict as soon as I write the CSS (cascading stylesheet) file for it but it had to be a
    quick update and removing all presentational elements and placing them in a CSS file is not quicker
    than just altering some tags. So this is where I got the idea to write a How to Convert HTML over
    to XHTML . Let's begin I'm having trouble knowing where to start ....
  30. Basic Tips and Tricks in HTML
    (15)
    Here is some quick links for basic html coding... A quick and easy way to create your first web
    page! -> The easiest HTML guide for beginners You'll learn how to create tables from real
    examples. -> How to create TABLE? You will learn how to create frames from a real example.
    You'll see how to create a borderless frame, how to specify the target frame, etc. -> How to
    build FRAMES? Follow a few easy steps to add sound to your web pages. -> How to add sound to a
    web page? This page tells you how to automatically load a visitor to another web page.....

    1. Looking for backing, user, forms, static, html






*SIMILAR VIDEOS*
Searching Video's for backing, user, forms, static, html
Similar
How To Enable User Login Security On Windows Vista - NOT User Account Control
How To Change Your Windows User Environment Variables - a step-by-step guideline
Good Books For Html And Css Beginners
Basic Html Tutorial - Made it myself, hope you like it.
[c/c++][linux] Linking With A -l Is Static Or Dynamic? - How will it effect distribution and portability?
What You Need Before You Can Create A Text-based Game.. - Using PHP, HTML and MySQL
User Account Control
Joomla Template Kit Extension For Nvu/composer - help in understanding how to change html template to joomla
Indentation In Html
Yahoo! Messenger Power User
Web Editor - great application for your html and javascript development
How To: Display A Members/user List. - With PHP, Mysql, and HTML.
Mysql And User File_priv
Style P And H? Html Tags
How To Create A "user Profile" Page. - No design (easy to add later if you want).
Yaml - (x)html/css Framework
Increase Your Knowledge Of Html Language
How To Create/edit/delete Ftp Accounts With Php - Help me to create one php page to create FTP user accounts in Unix Ser
Html Basic Tutorial - <!-- For beginners only -->
Graphcal User Interfaces In Java - How do you make them?
How Do I Create Static Routes In Windows Xp?
Converting PSD To HTML
How Can I Make Xp User Autologin ? - I know how to make the Administrator user automatically log in in Wind
New Features In Visual Studio 2005 Windows Forms
Get User Input From Vbscript For Batch Files - Get user input from vbscript
Laptop Hangs When Loading User (xp) - My laptop is hangin when it is loading
Switching Forms - VB.NET - Some VB.NET Basics
Secret Behind Your Nick/User Names - Where did they come from?
Converting HTML over to XHTML - Crossing over to the darkside
Basic Tips and Tricks in HTML
advertisement




Backing Up User Forms As Static HTML



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE