Check mysq_field_type, display appropriate FORM element
| From: | René Fournier | Date: | Thu, 23 Oct 2003 22:07:50 +0000 |
| Subject: | Check mysq_field_type, display appropriate FORM element | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-167195@lists.php.net to get a copy of this message | ||
Hello everyone,
I'm upgrading my simple CMS app, and would like to add a [simple] function to it—which I'm finding is no so simple (at least for me). To illustrate:
The user clicks "Edit" on a particular table row. The CMS then fetches that row from the table and begins displaying the value of each field in a form (which the user can then edit and at then click "Update") . So far, so good.
What I want to add is a function that will, depending on the field type (text, set, enum), display the field value as either a <textarea> or <select><option>. For example, for a field called "status", which is of type ENUM, and can contain the values "Online" or "Offline", I want this CMS function to return something like "<select><option>..." along with the allowed values, with the active one selected.
Beyond this, I'd like to extend this check_field_type function to handle fields that contain links to images, etc. But this is where I need to start.
Thanks.
...Rene