Jump to content

Recommended Posts

For those of you who don't like to read long posts, I'm sorry.  But, I think it would be a disservice to not include as many details as possible - so you can see the broad scope of the project (what I'm trying to achieve) and to lay groundwork for my current problem.

 

And, to those who don't like to download attachments - again I'm sorry.  But, I can assure you that I'm not uploading anything harmful.  I'm only doing it to provide all of my source code so that others can help me and/or learn from it.  If preferred, I can post all of the source code too - if asked.

 

=======OVERVIEW of the scope of the project=======

 

I am a Safety Representative within a company.  One of my tasks is to observe behaviors of employees and document trends as they relate to safe and at-risk actions.  I already created a program that uses excel forms that I input into it to spit out statistics and neat graphs.

 

Now I'm turning to php / mysql to make my job a little bit easier - it's not needed, but it's something I find myself doing in my free time.

 

Basically, I want to be able to create forms to use for tracking these behaviors (this was easy enough to figure out in the way I laid out my mysql structures).  From these forms that I create, I want to record this information and in turn spit out statistics and graphs, etc....

 

I attached a .pdf as an example form that I have created.  Basically I want to be able to recreate this form via php and mysql (not that hard).  But what's troubling me is dynamically creating this form from the database (which I have achieved) and then posting the users' results to the database (this is the problem).

 

The user will be able to create their own sections to manage and keep track of statistics with.  I think the way I set up my database is the best way of tracking those results too -- I included a file to query the database to create the tables and structure along with some data to give you a look at how I set it up.

 

=======The Problem=======

 

I can dynamically create the form from the database and even have text input fields within each section and category.  I'm just having trouble with getting the submit button to actually commit it to the database.  I don't know where to begin.  Each row needs to it's own entry within a table, but I want the user to be able to fill out the form and submit it all at once.

 

With the code I included, everything works except for the actual submit button.

 

When the submit button is clicked, I want each row (I call them OBSERVATIONs in the database) to be recorded to the DATA table.  The DATA table keeps up with how many forms were submitted (so a user can later go back and see their entry).  Each OBSERVATION is recorded along with their data (safe, at risk, code, comments).  If the safe or at-risk fields have no entry then I don't want it to record (I can set this conditional up).

 

==============

 

I'm sure it will all make more sense if you look at my included code (that somewhat works), the way I set up my database, and the .pdf form I've included.  Basically I want to be able to add / create more forms or add / create more observations to each form all the while it dynamically keeps track of my stats.  I think setting up the database the way that I did will allow for me to keep track of more stats or show numbers in a different way.

 

[attachment deleted by admin]

To anyone who is afraid of attachments, they're clean. I just risked my 0s and 1s for you. :D

 

Anyway, I'm scratching my head as to what exactly you want to accomplish. I think by including too many details you confused everyone and as a result everyone gets stuck. Break down the project into pieces and work towards them step by step, expanding and changing as you go. An otherwise easy project will explode into a huge mess of problematic code.

To anyone who is afraid of attachments, they're clean. I just risked my 0s and 1s for you. :D

 

Anyway, I'm scratching my head as to what exactly you want to accomplish. I think by including too many details you confused everyone and as a result everyone gets stuck. Break down the project into pieces and work towards them step by step, expanding and changing as you go. An otherwise easy project will explode into a huge mess of problematic code.

 

Agreed.  My next implementation is small - I guess I didn't have a good way of explaining.  If you look at it, you will see there is a submit button.  I just need help getting the submit button working.  Maybe the script to echo "hey it works!" once the button is pushed.

 

I can't seem to get the submit button assigned to the form.  I'm getting the error:

Notice: Undefined index: submit in /Applications/MAMP/frameworks/SAFE/SAFE.php on line 123

 

Now I know 'submit' isn't the index to use - rather it should be 'safe' or 'at-risk', etc...  I don't know why I have 'submit' in this code.

 

If I can get the submit button to work with the dynamically created form, I'll be happy.  Then I can move on to adding the content from each row into the database.

 

======

 

And I appreciate your willingness to vouch for my files -- that sounds wrong.

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.