AnsweredAssumed Answered

PHP drop-down list data incorrect if space in value

Question asked by JimMonteath on Feb 2, 2011
Latest reply on Sep 6, 2012 by JeffHorton


PHP drop-down list data incorrect if space in value


FileMaker Server



Operating system version

OS X Server 10.6.6

Description of the issue

The code generated by the PHP Site Assistant (PHPSA) for drop-down lists returns incorrect values when a list item contains a space character. Only the characters to the left of the space are returned, the rest are dropped. The displayed data in the list is correct, but the underlying "
Cause: The getMenu() function in the fmview.php file generated by PHPSA does not put quotes around the value retrieved from the database. HTML

Steps to reproduce the problem

Any drop-down list published through PHPSA should demonstrate the issue. Specific steps to reproduce are:

1) Create a new database (e.g., "Test.fp7")
2) Create two text fields in the default table (e.g., "State" and "Visited")
3) Change to Layout Mode. Select a field to make a drop-down list (e.g., "Visited"). Change the Data properties to Control style = Drop-down list.
4) Create and assign a new Value List (e.g., "Visited List") with "Use custom values" and enter some values, at least one containing a space (e.g., "Never", "Once", "Many Times").
5) Add some records (e.g., "Alaska"/"Never", "New York"/"Many Times", "Florida"/"Once").
6) In Manage -> Security, assign fmapp & fmphp Extended Privileges to the Full Access role in the Database (e.g., Admin user).
7) Publish the database using FMS.
8) Use PHPSA to generate a "Full site with Record List" website for the Layout Group (e.g., Test) and serve it through Apache.
9) Access the website as the Full Access user. Select Find All.
10) Click the record number for a record to browse it. Click Edit Record button.
11) Select a drop-down value containing a space (e.g., "Many Times"). Click Save Record button.

Expected result

Field value in the edited record contains the drop-down list value.

Actual result

Field value in the edited record contains a truncated version of the drop-down list value.

Exact text of any error message(s) that appear


Configuration information

Using custom web publishing on OS X 10.6 Server's built-in Apache/PHP. Have not tested this with the FMS-shipped Apache/PHP, nor on another OS. Do not believe this to be a configuration-specific bug.


Manually edit (hack) the fmview.php file in the website folder to include the required quotes.

Locate the following line in fmview.php (around line 725):
  $options .= "";

Enclose $encodedStoredValue in single quotes:
  $options .= "";

This hack will be overwritten on subsequent PHPSA site generations.