Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Memorize form

  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Memorize form

    So I am creating an HTML form that is being submitted using php and being saved to a text file. What I want to do now is take that data and reinject it into the form, so that it looks the exact same as when someone comes back to the site. In other words, making the form save itself. I want to use php and save data to a text file because I can't figure out mySQL. The form itself is based on HTML and JavaScript. It contains text areas and check boxes. Any help is greatly appreciated. Also I want the form to be the same for everyone who looks at it. Long story why, but yah.

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,396
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    I know you were using checkboxes numbered like 1 2 3 4 5 etc.

    But, are you sure you didn't mean to use radio buttons?
    With checkboxes, the user can click two of them, three of them, etc.


    .

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,093
    Thanks
    51
    Thanked 506 Times in 493 Posts
    I'm afraid that if you want your site to remember a users form details you will have to get to grips with mysql.

    You could store the data temporarily in a session (which is basically an array called $_SESSION) but many browsers do not save session id data when they are closed. Also using text files is totally unsecure and not even thread safe meaning that two users could alter it at the same time and you'd have corrupt data.

    I know MySQL sounds scary but it really is simpler than you realise. It's thread safe and takes care of everything for you in a table similar to a spreadsheet (except more advanced so you can run searches etc).

    If you've not been there, tizag.com have excellent tutorials.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #4
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I actually want people to be able to select multiple things using check boxes, and if I use MySQL, how would I do so, and how do I create a MySQL file (I am using Mac if it is software

  • #5
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,396
    Thanks
    8
    Thanked 1,078 Times in 1,069 Posts
    Show us an example of the form, and if you are using checkboxes,
    will the checkboxes be numbered, or will each checkbox have a description
    next to them ... I'm wondering if you only care about which boxes were
    checked, not specifically the word (or value) of it. As you mentioned, you
    will redisplay the same form with the checkboxes checked from the last
    person that viewed the form. Each viewer can change the checkboxes and
    resubmit the form, overwriting the previous viewer's choices?

    I'm working off of this ....
    Need help saving HTML form using php to a text file



    .


  •  

    Posting Permissions

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