Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:27:16+00:00 2026-06-08T10:27:16+00:00

I’m making a CMS with PHP just as practice and want to give a

  • 0

I’m making a CMS with PHP just as practice and want to give a user the ability to create custom form fields that can be used on their website’s signup/registration (similar to SocialEngine or PHPFox). However I really don’t have a good idea as to how I am going to accomplish this. Would I have to make some sort of plugin (“hook”) system? I originally had this in mind but I don’t know if this is really a good way to go:

The admin of the CMS would be given a form with the options of the form field’s name that they want to create, the type of field(string, boolean, date etc.), the category of the field and whether or not it is a required field.

The values would then be passed into a database table called “custom_form_fields” with the columns: id, field_name, field_type, category, required.
Also to store the values of these fields; a column would be added to the ‘users’ table where all the user’s data is stored.

ALTER TABLE users ADD the_custom_form_field_name datatype

But now I’m confused about how I would display the different form fields in PHP and how I would insert that data from the form fields into the user’s table.

If you don’t understand my question please look at: http://www.phpfox.com/features/custom-fields/ It shows what I am trying to achieve.

Can anyone help me out with this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:27:19+00:00Added an answer on June 8, 2026 at 10:27 am

    You need to slow down a little; at first it seemed like your question was about the js/php code for generating HTML forms dynamically, but then you started talking about the database fields.

    Your question is still not 100% clear to me, but what I’d do in your situation is start off with the database design and focus on nothing else.

    I can see that you’re thinking about altering the users table. I don’t think that would be necessary, nor good design.

    So long as the each user has a primary key i.e. users.id field, you could create a new table just to store form field data like this:

    CREATE TABLE users_custom_form_data(
      id INT NOT NULL,
      FOREIGN KEY(id) REFERENCES (users.id) ON DELETE CASCADE,
      /* then store any data you need to store about a form field */
      field_type ENUM("text","number","phone","email","submit","etc"),
      field_default_value VARCHAR(100) /* or what you think is necessary */,
      field_name VARCHAR(100),
      field_id VARCHAR(50),
      field_class VARCHAR(50)
      /* and any others you need */
    ) ENGINE = InnoDB;
    

    Since we’re assigning each record to a USER ID, we can later track which users own what custom form fields.

    I hope this is enough to get you started.


    Since you clarified your question, I think what we are looking at now is a table with a field for the user ID that owns the record, a field for the custom attributes table id to reference their custom fields. It would look like this:

    CREATE TABLE tbl_user_attributes(
        user_id INT NOT NULL,
        FOREIGN KEY(user_id) REFERENCES(tbl_users.id) ON DELETE CASCADE,
        attribute_id INT NOT NULL,
        FOREIGN KEY(attribute_id) REFERENCES(tbl_attributes.id) ON DELETE CASCADE
    ) ENGINE=InnoDB;
    

    Then the attributes ID will tell you what kind of field the user added to their CMS. The attributes table will be pre-populated by you and defined by you (with your default fields). It could look something like this:

    CREATE TABLE tbl_attributes(
        id INT NOT NULL AUTO_INCREMENT,
        text_label VARCHAR(100),
        type ENUM("TextArea","CheckGroup","DropDown"),
        data BLOB
    ) ENGINE=InnoDB;
    

    So once you have populated that table with options, the user should be able to add any of those types of fields (on top of the default fields) and give it a name i.e. “Movies” would be stored in the field named ‘text_label’ and it would be of the type “TextArea”. That tbl_attributes.id would then be inserted into the tbl_user_attributes with the user ID of the user that created it. Then your program would do the rest, by reading the database. If you want to store user data in that, store it in the ‘data’ field (if its ALWAYS text, you could use a TEXT type instead of a BLOB but using a BLOB isn’t a problem as you can work out what you need to do with the data judging by the ‘type’ field i.e. a TextArea means text was stored in the BLOB.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.