Jump to content

simple checklist form question


Recommended Posts

Hi,

 

I'm writing a simple checklist for monitoring workflow. It will be a form, a list of tasks with radio buttons that return '0' or '1'.

 

I'm planning to store the results in a MySql db, i'm just wondering what the best way to do this is.

 

My initial thoughts are to store the results as a string in one field in the db (like '11100100010' etc) and then split that out to feed the form using LEFT in the query (LEFT(Field, 3) as 'Job 3' or something like that).

 

If that is a sensible way to do it - how do I go about creating the string from the 'submit', i mean, i understand how to update the DB, thats fine - I'm just not to sure how to create a string from several form elements??

Link to comment
Share on other sites

The question of using one or many fields depends on the number of inputs you have.  Also remember that if you use one field, then for every query against the database you have to run some extra processing to get the result extracted.

 

Personally, i would use separate fields for each one.

 

To create a string from submit, you assign the posted variables to a variable in your action script

$var1 = $_POST['var1'];
$var1 = $_POST['var1'];

 

and to string them together, if you want to use 1 table field

 

$string = $var1.$var2....

Link to comment
Share on other sites

ah ok, so its more efficient to have a database with sat 100 fields, each containing 1 or 0 than to have one field with a string of 100 chars.

 

Ok, in that case its I dont need to concatenate the form results.

 

Thanks!!

 

Remember, I said that it depends on how many fields you have.  You can try either way to see if it makes a difference in performance.

 

 

Simply, you 2 choices for a select are

 

With 1 field

- Select field from table.

-  run string function to locate and extract one of multiples values

 

With multiple fields

- Select fields from table

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.