Frequently Asked Questions

How does the file upload work?
Currently, this script allows you to specify a directory to upload any file field files in a form you create. The value placed in the database will be the directory pathname you specified and the filename (e.g., /files/myfiles/myfile.doc). Please also note that, while you can specify error checking for file fields (like required, file size, etc.), a required error check will only be implemented for the add mode (adding new content) NOT the edit mode. I’m sure there are other (and better) ways to do this, but…
FCKeditor Info
Currently, this script uses version 2.3.2 of the FCKeditor for the textarea_FCKedit field option. You can always upgrade to the latest version by just replacing the folder FCKeditor. BUT NOTE: If you update and wish to take advantage of the file manager feature read on for instructions…

File/Image Browsing

UPDATE: Read on for the original thoughts on making the FCKeditor filemanager work, but I have recently found ImageManager, which is a very nice alternative to using the default filemanager for uploading and choosing images. Reference the following:
Use Xinha’s Imagemanager In Fckeditor
Naturally, you will want to make sure to password protect or take other appropriate security measures for the ImageManager directory.

The filemanager feature of FCKeditor seems to be one of the biggest headache areas for many folks. I am no expert on FCKeditor and there may be a better/easier way to do this, but if you want to use the browse server option for images and links there are some things you should know and some things you should do:

1. The default folders that are supported are:
You may think (like I did) that it makes sense to be able to change these to whatever you feel like. Well, it can be done and you can find instructions at:…543655

Note: the instructions found on that page forget to tell you to change the line:
$Config['UserFilesPath'] = '/UserFiles/' ;
$Config['UserFilesPath'] = '/' ;

Also, if you’re having any problems getting your new folders to work properly, remember you can use the file:
to help test out different path and filename changes you make.

2. For folks who don’t want to bother with figuring that out, I decided to use the default folders and so I included them in the phpAddEdit distribution code. If you are using the default phpAddEdit install files you shouldn’t need to do anything other than make sure the /UserFiles/ directories’ permissions are set to 777 and realize that any files you want to work with will reside there.

IF you decide to update to a newer version of FCKeditor AND IF you aren’t using the base directory of your site AND IF you aren’t changing the default folders as described above, you will need to tell FCKeditor where to find the /UserFiles/ folders. In the file editor/filemanager/browser/default/connectors/php/config.php, replace the line:
$Config['UserFilesPath'] = '/UserFiles/' ;
$Config['UserFilesPath'] = $cwd.'UserFiles/' ;

3. If you decide to update to a newer version of FCKeditor, in the file /FCKeditor/fckconfig.js set _FileBrowserLanguage and _QuickUploadLanguage to php (the default is asp).

Height, Width
Note that while you can set the rows, IF you specify anything less than 200 the actual height will be set at 200px by default (but if you set rows to something greater, like 350, that will override the default). Currently, the width is set to a default 100%. If you can’t live with these constraints, either (1) don’t use FCKeditor or (2) manually change the file addedit-form-fields.php.

Dialog Popup Size
For me, I have had a problem with the dialog popup window being too small and not allowed to be resized (I use Firefox). If you have the same problem and want to fix this, in the file editor/fckdialog.html,
<body onload="LoadInnerDialog();"
<body onload="LoadInnerDialog(); window.resizeTo(screen.width-200,screen.height-200); window.moveTo(50,50);"
You can play with the numbers to suit your own tastes…

— Auto-select the “Remove Styles definitions” checkbox when pasting from MS Word —
In the file editor/dialog/fck_paste.html, replace:
<input id="chkRemoveStyles">
<input id="chkRemoveStyles">

Custom Modifications
You can do different things with FCKeditor, like changing the default styles, language, theme, toolbars, etc. That however, I leave up to you. To make your modifications, do whatever you want and then overwrite the FCKeditor directory with your changed files. You may want to write down your changes so if you ever decide to upgrade to the latest version you won’t lose your customizations…

More Help
For more useful FCKeditor configuration information, visit

I want to do something extra when a form is submitted - can I?
Yes. There are three types of customized actions you can specify:

Pre-Render Code
Before a form is rendered (created/displayed) the file
is included and any PHP code in it will be processed. So, if you want to do anything special/extra before the form is created, just stick it in that file.

Execute Code
When a form is submitted the content is added (or edited). After this, the file
is included and any PHP code in it will be processed. So, if you want to do anything special/extra, just stick it in that file. For example, in the form creator wizard you can specify two emails be sent. If you wanted to send a third, you could use the following code:
phpaddeditmailer ($email_to, $email_cc, $email_subject, $email_body, $attachment, $attachment_name);

Error Checking
When the form is submitted, before any execution code takes place, error checking is done (based on the criteria you specified for the form). This is pretty robust, but still you may need something else checked. You can do that by adding code to the file:

How do I make the selectbox_other feature work?

The selectbox_other fields are the most complicated aspect of the phpAddEdit script. I don’t recommend using them until after you have become pretty familiar with phpAddEdit and I strongly urge you to test any form you create (good advice regardless) before making it live.

To use a selectbox_other field, it is very important to realize that there are 3 different selectbox_other field types:

  1. selectbox_other – here you can choose (or add via the _other field) only one item; this works pretty reliably because the code is more straightforward
  2. selectbox_multiple_other – here you can choose and/or add via the _other field one or more items; this field is intended for database field entries where multiple choices are entered with separating commas, which chould be useful if you don’t want to have to do linked tables and inner joins, etc.; do note that if a form user chooses one or more items AND uses the _other field then the script will include the selected items and the added items
  3. selectbox_multirow_other – here you can choose and/or add via the _other field one or more items; this field is intended for situations where multiple choices represent multiple table entries. The way I use it (and probably the only way it will work properly right now) is in the situation where you have a table of the sort: tableA2tableB where tableA and tableB entries are connected. For example, if you had two tables, one for article titles (articles) and one for authors (authors), you would want to match the authors with the article titles and could do that by a connecting table called article2authors. If we assume a simple form to add an article title and related authors, we would make a form using two tables: articles and article2authors (NOT authors). Here we would probably make the articles.title field a textbox and the article2authors.authorID a selectbox_multirow_other field. This may seem a bit counter-intuitive but if you assume that the _other field doesn’t get used (thus the selectbox_multirow_other field acts just like a selectbox_multirow field) it makes more sense. In such a case, we are only using the authors table to select names. The textbox field would affect the articles table and the selected author(s) would affect the article2authors table. No need to mess with the authors table. Now, if we assume the _other field does get used, what should it do? Well, it should update the authors table NOT the two tables we used to create the form! Don’t worry, we take care of that for you via the selectbox population SQL. Read on for those details…

In all selectbox_other cases, it is important to know that entries added via the _other field will be added to the tablename in the SQL query used to populate the selectbox NOT in the tablefield that you defined as a selectbox_other field type. Using the articles and authors example from the selectbox_multirow_other note above, we might have a field in our form representing the table article2authors with the fieldname author_id but we would want the selectbox to be populated with names from the authors table so we might use SQL like SELECT * from authors. Now, if the user of the form adds an author via the _other field, the script will look at the SQL statement to determine which table gets the new _other addition, which will be authors NOT article2authors. For more complicated uses of the selectbox_other field types, remember that you can add code in the file addedit-execute-custom.php.

WordPress example. If you look at the file that is installed by default you will see how I created the categories selectbox_multirow_other field for the wordpress_content form that you can view in the demo. What is useful to know is that the phpAddEdit script creates an array variable called $insert_id which keeps track of the primary key insert IDs for all the tables that are a part of your form. It is also useful to know that the $page variable holds the name of the current form so you can add code for multiple forms. In our case, the form we care about is wordpress_content.

The selectbox_multirow_other field for this form is for the table wp_post2cat which is populated by the category_id from the table wp_categories. So, the selectbox field name for the “_other” textbox option ends up being wp_post2cat_category_id_other. Since we want to add to the table wp_categories when we use the “_other” textbox, we care about the $insert_id array entry for that table, specifically $insert_id["wp_categories"]. First, do some checking to make sure that the “_other” textbox was even filled out and if so, create your customized sql statements as follows:

if ($_POST["wp_post2cat_category_id_other"] && $insert_id["wp_categories"][0]) {
foreach ($insert_id["wp_categories"] as $i=>$value) {
$custom_sql = "INSERT INTO wp_post2cat (post_id,category_id)
VALUES (" . $insert_id["wp_categories"][0] . "," . $value . ")";
$custom_execute = mysql_query($custom_sql);
if (!$custom_execute) $error_message .= "An error occurred adding an entry to post2cat";

How do I email the user after he/she submits a form?
This is done in the Email Options step (currently Step 9). Basically, you need to set the email to address field. The trick comes when you want to send an email to a variable rather than a static email address. I can imagine two common scenarios:

  1. The user fills in his/her email address on the form – in this case, keep in mind that the form field will be the tablename and the fieldname. So, if you title a text box for an email input as email and the table is called email_alerts then the form field will end up being titled email_alerts_email. In that case, enter $email_alerts_email for the email to address option.
  2. You already have the user’s email address stored in a variable – in this case just use the variable name (with the $ – e.g. $myvariable) for the email to address option.
How do I selectively display a field?
If you want to skip or change the type of a field based on some criteria use the addedit-customize.php file to set a skip variable; it should be of the form $tablefield."_skip".

For example, if you have a table called content and it has a field called html that is active for certain types (e.g. articles) but not for other types (e.g. links) then you could check the type of content being added or edited and if it is a link, skip the html field on the form.

if ($type=="link") {
$skip = "content_html_skip";
--- use this to completely skip inclusion of the field
$$skip = "skip";

Alternatively, you may want to include a field but not allow it to be changed. You could do this by using a hidden form field or a non-editable text field. Let’s say you have a user profile/registration system. On registering a user must specify a username but you don’t allow that username to ever be modified. In that case, for the editing version of the form (e.g., what a user sees in his edit profile page) you might choose to show him/her the username as a non-editable text field as follows:

if ($editing) {
$skip = "members_username_skip";
--- use this to create a non-editable text box instead of skipping
$$skip = "textbox_noedit";
--- use this to create a hidden form field instead of skipping
$$skip = "hidden";

Will you help me do...?
Probably not. Not because I am mean but because I am very busy. If your question is general and deserves its own entry in this FAQ, then by all means ask away and maybe I can help.
What does _X_ file do?
Check out the files page
I have 2 fields that should have the same value but I don't want to make the user fill out both fields. How can I assign the value of one to the other?
Just make the second field hidden and in the default value option, assign it the posted variable value for the field that does get filled out. Keep in mind that the fieldname is actually prefixed with the table name. So, for example, if you have two fields: field1 and field2 in table mytable, you would assign the default value for the hidden field (let’s say it’s field2) as follows:


Keep in mind that you can accomplish this and even more complicated things by using the customization files (addedit-customize.php, addedit-execute-custom.php, addedit-error-check-custom.php).

Click to see/join the conversation