Subforms in php? Throw normalization out the window? (1 Viewer)

CraigDolphin

GrumpyOldMan in Training
Local time
Today, 03:02
Joined
Dec 21, 2005
Messages
1,583
ok...provocative title I know. ;)

I'm working on teaching myself php/mysql and have gotten some functional php scripts working on my local copy of WAMP. I can get query results, and do basic insert/update etc on a mysql database.

The problem I'm faced with is wanting to write a php page that functions similarly to a form/subform arrangement in Access for entering data into one table, and related data in another 'details' table (with a one to many relationship between the tables).

Having found NOTHING that leads in that direction, I'm damned well tempted to just add fields to the first table (there would be a maximum of about 12 extra fields) and be done with it. :eek:

But....you knowledgable Access gurus have instilled in me a horror of such non-normalized table designs and I'm having qualms about giving in to the dark side. :(

I've thought about using the onchange event of an html form input element to call a javascript function that builds the url for the php by looping through form elements and their values, and constructing an extra line dynamically whenever the new element is populated by the user. I can conceptually see how to do this, but I'm told that the url can only contain about 100 characters and some of the input fields will potentially contain paragraphs of text. This would obviously create a big problem because I could not then automatically repopulate the user's input when the php form is reloaded. (I hope that makes some sense).

I'm not asking anyone to do this for me, just whether anyone can point me in the right direction or, ideally, show me a tutorial/example script of someone using php/mysql/javascript to construct a simple form/subform analogue.

Or to bless the unholy denormaliztion which I am contemplating. *shudder*
 
Last edited:
Local time
Today, 05:02
Joined
Mar 4, 2008
Messages
3,856
There's a reason I love Access. You've touched on much of it.

My ex-boss wrote the Helix PHP framework which is totally normalized. It is available here: http://sourceforge.net/projects/helix/

I worked as a programmer on the Helix project for quite a while and it was a bit odd in that the "master" to "child" entity relationships were upside down. It's kind of strange from a data modelers viewpoint but makes plenty of sense from an object oriented programmers viewpoint.

Damian (my boss referenced before) used a javascript library on his projects and was able to create some incredibly impressive master/sub-form configurations. I can't remember which library he used and he is not online at the moment to ask him. If you're interested, let me know and I'll try to find out more for you.
 
Last edited:

CraigDolphin

GrumpyOldMan in Training
Local time
Today, 03:02
Joined
Dec 21, 2005
Messages
1,583
Thanks George :) I'll check out the link and see what I can learn :)

Cheers!
 
Local time
Today, 05:02
Joined
Mar 4, 2008
Messages
3,856
It's cool. I just chatted with Damian and he tells me the javascript library he was using is ExtJS.
 

speakers_86

Registered User.
Local time
Today, 06:02
Joined
May 17, 2007
Messages
1,919
George, do you mind explaining what that does?
 
Local time
Today, 05:02
Joined
Mar 4, 2008
Messages
3,856
What which does?

Helix is an open source PHP framework with a normalized MySQL database backend. The company I was working for used it for HR, Project Management, Time Management, and managing multiple logons, though I'd say that it's not limited to that.

ExtJS is an open source Javascript library.

Unfortunately my work on Helix was backend interface development (getting/putting MySQL data into/out of PHP) so I never really learned how to use it as a front-end in a real-live application. But I can say that I manipulated Helix data in the database for merging companies and mass data loads. I also wrote/customized some of the PHP code for Project Management.

I can try to answer any more specific questions you have.
 

Users who are viewing this thread

Top Bottom