publicly populate a list field

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 23, 2009   (RSS)

By Shore - November 20, 2009

Hello,

How can I publicly populate a cms builder multiple-select list field?

I have a list field called 'activity' that is grabbing it's values from another table 'activities' where $num is the value and $title is the label.

At the top of my page that has the html form, the mysql UPDATE statement for the activity field is as follows:

-----------------------

activity = '".mysql_real_escape_string( $_REQUEST['activity'] )."',

-----------------------

then in my html form

-------------------------
<select multiple="multiple" name="activity" id="activity">
<?php foreach ($activitiesRecords as $recordActivity): ?>
<option value="<?php echo $recordActivity['num'] ?>"><?php echo $recordActivity['title'] ?></option><?php endforeach; ?>
</select>
-------------------------

On the html form, a user can select multiple activities, but when the record is added to cms builder only the last selected activity becomes checked in the cms builder record.

Any ideas?

Thanks

Re: [Shore] publicly populate a list field

By Chris - November 20, 2009

Hi Shore,

I'm having trouble figuring out exactly what it is you're trying to accomplish. Can you please attach the complete PHP source code for the page (or pages) you're working on so I can take a closer look?
All the best,
Chris

Re: [chris] publicly populate a list field

By Shore - November 20, 2009

Hi Chris,

Attached is my php.

In CMS Builder, organization.activity is a list field that pulls it's values from another table called activities using num as the value and title as the label.

Between lines 273-275

<select multiple name="activity[]" id="activity" style="margin-left: 280px;"><?php foreach ($activitiesRecords as $recordActivity): ?>
<option value="<?php echo $recordActivity['title'] ?>"><?php echo $recordActivity['title'] ?></option><?php endforeach; ?>
</select>


I'm attempting to post it's array value and insert it into the organization.activity list field.

Appreciate any help. Let me know if you have any questions.

Thanks