phpAddEdit Script Usage Notes
To use this script, just follow each step in order and things should be more or less obvious. Where appropriate, I have
added popup notes on headings to offer more detailed information or instructions. However, a couple of powerful
features need some more detailed explanation - especially the selectbox_multiple and the selectbox_multiple row options.
- selectbox (other) - a regular select box but with a textbox beside it to add an option if it
doesn't exist. If the select box is populated with values from a database table, the added option value will
automatically be added to that table. Since a basic selectbox only allows one selection, the textbox value will
replace anything that may be otherwise selected
- selectbox (multiple) vs. selectbox (multiple row) - these are essentially the same field types,
the difference being that when the form is processed a selectbox (multiple) will produce a single string value
that consists of all the selected items separated by a comma whereas a selectbox (multiple row) will actually add
a new database entry for each selected item. Note that the 'other' versions of these fields act like the
selectbox (other) field described above.
- selectbox (multiple row) - In some cases you may want to manipulate multiple tables at once with one
of those tables having possibly multiple entries. For example, say you have a table called
posts and a
table called categories. It could be that each post may have multiple categories (e.g., leadership,
management, marketing...). In that case you will likely have a connecting table, say posts2categories
which relates the posts table entries with their categories table relationships. In other words,
if a post had three categories, there will end up being three entries in the posts2categories table. So, and
this may seem a bit counter-intuitive, when you create your form you will include only TWO tables, posts, and
posts2categories. You will NOT include the categories table. Instead you will use it
to popule the selectbox (multiple row) field which you will define for the table posts2categories.
Now, assume your posts2categories table has three fields, relID which is just an index,
posts_id which specifies the relevant posts table entry and categories_id which
specifies the relevant categories entry that are to be connected.
When you get to the Tables menu in the phpAddEdit software (Step 3) you will set the Edit Field as
posts_id. Then at Step 4 (Fields) you will select the categories_id as the only
field to include. Next, at Step 5 (Options (1)) you will assign the categories_id field to a
selectbox (multiple row) or a selectbox (multiple row) other field. Finally, on Step 6 (Options (2)), you
will specify the posts_id field as the Relative ID. Then you will use the
Populate With... option to fill out the selectbox. Here is where the table categories actually
comes into play. For example, you might fill that option with an SQL statement like
"SELECT * FROM categories ORDER BY category".
At first, I am sure this process seems a bit strange, but if you think about it for a while, I hope it will make
sense to you. Also note that if you choose the selectbox (multiple row) other option, the script is smart enough
to use your SQL statement to figure out which table (categories) needs to have the "other" option added to.
Final Note: if you use this option successfully and can do a better job of explaining it, please send me your explanation.
|
Demo
Check out the script in action with the Live Demo
Announcement List
Signup to receive news about the release of new versions or other pertinent phpAddEdit information.
Donate
phpAddEdit is a free program but if you appreciate my efforts, please consider a small donation.
|