May I use enum values from a custom table in forms made with Gravity Forms?
May I use enum values from a custom table in forms made with Gravity Forms?
Can you explain more about what you are trying to do, please?
I'm locking for a plugin that can handle my custom table with enum-fields in. I would like to have a form that builds a drop-down list from the enum values that already excist in the table.
Like this php:
$result = mysql_query("SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '$table_name' AND COLUMN_NAME = '$column_name'")
or die (mysql_error());
$row = mysql_fetch_array($result);
$enumList = explode(",", str_replace("'", "", substr($row['COLUMN_TYPE'], 5, (strlen($row['COLUMN_TYPE'])-6))));
foreach($enumList as $value)
echo "[option value=$value]$value[/option]";
echo "[/select]";
All the best,
Mikael
If you would like to dynamically populate a drop down field on your form using values from a custom database or custom tables, you can do so by dynamically populating the field using available hooks and custom PHP.
This would only allow you to populate the drop down options, the form is still going to store it's data in the Gravity Forms entry tables unless you customize it further to behave otherwise.
Here is information on how to dynamically populate a drop down using PHP:
http://www.gravityhelp.com/documentation/page/Dynamically_Populating_Drop_Down_Fields