Announcement

Collapse
No announcement yet.

How do I keep forms from overwriting existing data?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I keep forms from overwriting existing data?

    I'm new to MySQL and vBulletin so if this has been answered before I apologize for asking this again. I didn't see any other posts on this so here goes...

    I have a form on my site which my customers will be updating frequently. How can I allow them to update only one or two fields (or more) without overwriting all the other data?

    I asked this on vBulletin.org but I'm not clear on the answer so when you reply could you be specific? For instance, if I have a field titled firstname that I don't want changed and a field named location I want to update with new information how would I write the code?

    Thank you in advance,

    FaShUnPhOtOg

  • #2
    Updating what fields exactly? It does sound like this requires modifying the code. We cannot officially support code modifications or forums running modified code, however can try searching or asking for help with this over at www.vbulletin.org.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment


    • #3
      If you are talking about extra fields you want to store in each users profile, then you can do what you want with User Profile Fields.

      If you only want the user to be able to enter the information at registration time, but not edit it afterwards, then simply set "Field Editable by User" to Only at Registration.
      Want to take your board beyond the standard vBulletin features?
      Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

      Comment


      • #4
        Oops! Sorry...

        I wasn't very clear was I? The form is one from an add-on I've modified for my own needs. The data being sent is to my database. I don't know enough about how vBulletin and it's add-ons interact with MySQL to figure this out but I'm told it's relatively simple once you know how....

        Simply put, I have a profile page for models to enter their data on. This includes their names, height, weight, etc... Models (and other talent) being models (talent), they need to update their information regularly. The problem I'm running into right now is that they can't even upload photos or change just their hair color, weight, stats, etc... without having to fill out every field each time so their data's not lost. What code snippet do I add to check the fields for change and only overwrite the data which should be updated?

        On the vBulletin.org forum, a user suggested I use something like:
        if ($formnamefield)
        {
        $nameupdate = "name = '" . addslashes($formnamefield) . "',"
        }
        else
        {
        $nameupdate = '';
        }



        I'm assuming I should substitute the actual field name for formnamefield
        eg., $firstname replaces $formnamefield - but I'm not clear whether or
        not I should do the same with $nameupdate. Should I substitute again here?

        Comment


        • #5
          Well the most used solution for this kind of problem is to prefill all fields on the edit page, with the current values.

          If the user then submit her changes, you can just update all fields. Fields that have not been changed by the user, will still hold their original values, so no checking or other processing is needed.

          But to go more indepth into your specific problem, you would really have to stay with it at vbulletin.org, since we can go much further in helping with custom coding problems then here on vb.com
          Want to take your board beyond the standard vBulletin features?
          Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

          Comment


          • #6
            That's what I need :-)

            Yes, pre-filling the fields woud work just fine. I don't know how to write the code snippet for that. As mentioned previously, I did open the same thread for discussion on vBulleting.org. I don't know if I'm linking properly but here's what came up in my browser: http://www.vbulletin.org/forum/showt...erwriting+data

            If anyone would be so kind as to help I would greatly apprecite it and will be happy to place a link to your site on my credits page.

            Thanks,

            FaShUnPhOtOg

            Comment


            • #7
              Just replied there
              Want to take your board beyond the standard vBulletin features?
              Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...
              X