Hi All

I am building a web and desktop application where the user fills in a web form that is posted to a MySQL database. The database info is then collected by a desktop application for easy retreival.

I know that my clients will want to have a web form that is configurable, where they can switch off and on fields that are related to their specific needs.

I would like to have one configuration file that the webform and the desktop application could read from so that only the relevent fields are displayed and posted to. I'm guessing that I have to use XML but maybe someone with the experience has a better idea?

I'm using VB.net for the desktop app and php for the online form.

Many thanks in advance

John

Assuming your clients are held within the database why not make it so they set their settings before filing out the form. which could update the database and then simple use PHP IF statements to either show or hide the data specific to the column on the database.

Assuming your clients are held within the database why not make it so they set their settings before filing out the form. which could update the database and then simple use PHP IF statements to either show or hide the data specific to the column on the database.

Wow quick response. Thanks

Just to clarify - The database(s) will hold the information of my clients customers. I thought about setting up another table within the database(s) that holds the configuration of the fields in the form to be displayed(i.e. firstname = off, surname = on, DOB = on etc).
I would then use php to read from the configuration table as to what should be displayed. It just seems very long winded and I was assumming that there would be a more standard and efficient way?

John

well I suppose you could use sessions or cookies but they would be then required to be reset again when the user logs out of your program or closes it. So that wouldn't be ideal, best thing I can think of is a DB table xD

well I suppose you could use sessions or cookies but they would be then required to be reset again when the user logs out of your program or closes it. So that wouldn't be ideal, best thing I can think of is a DB table xD

I think I've been avoiding the innevitable and will have to face the the long hours of programming lol. Thanks for your rapid response

John

No problem :)

hopefully it wont take too long depending on what needs to be done.

Member Avatar for diafol

web and desktop will be using the same primary datastore? MySQL? I know nothing about vb.net other than you can connect to mysql.

If a user logs in, you can store the preferred form settings in a DB.

I tend to use bitwise operators for this sort of stuff. Alternatively you could serialize booleans for yes/no.

BIT VALUES
field1 = 1
field2 = 2
field3 = 4
field4 = 8
field5 = 16
(..etc..)

Your user could have this in the 'form_pref' field in his record in your users table:

user_id | username |     pw     | form_pref
   7         fip     kbhuwsDtG       21

This relates to field1 and field3 and field5 (1 + 4 + 16 = 21).

Here's a simple php check. You can make a bitwise comparison in SQL too.

For field1:

if(1 & $form_pref != 0){
  echo "field1 chosen";
}else{
  echo "field1 not chosen";
}

//OR

if(1 & $form_pref != 0){
  echo '<label for="field1">Field1: </label> <input type="text" id="field1" name="field1" value="' . $row['field1'] . '" />';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.