Re: [Shore] publicly populate a list field
Hi Shore,
Multi-value fields are stored in CMS Builder's databases as a tab-separated list of values, with extra tabs on both ends to facilitate easy searching.
When submitting a form with a <select multiple> with an "array name" (eg. activity[]), PHP should be giving you an array of values. Since you said above that "$num is the value", you'll want to make sure that your <option values> are record "nums":
<select multiple name="activity[]" id="activity" style="margin-left: 280px;"><?php foreach ($activitiesRecords as $recordActivity): ?>
<option value="<?php echo $recordActivity['
num'] ?>"><?php echo $recordActivity['title'] ?></option><?php endforeach; ?>
</select>
To convert the array of values to a tab-padded, tab-separated list, you can use the following code:
activity = '\t".mysql_real_escape_string( join("\t", $_REQUEST['activity'] ) )."\t',
I hope this helps! Please let me know if you have any questions.
All the best,
Chris