View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Saving Multiple Selections

Thread began 11/25/2009 3:18 am by Jaffa | Last modified 11/24/2014 1:07 pm by Jaffa | 4583 views | 23 replies

Jason ByrnesWebAssist

The implode function goes in the code that performs the insert or update.

In the case of the dreamweaver insert record code, lets say the INTERESTS form element is a multiple select list, you would need to adjust the insert record code like this:


$updateSQL = sprintf("UPDATE tblPractice1 SET memberID=%s, DIMENS=%s, INTERESTS=%s, languages=%s, ages_served=%s, treatment_techniques=%s, geo_location=%s WHERE practiceID=%s",
GetSQLValueString($_POST['memberID'], "int"),
GetSQLValueString($_POST['DIMENS'], "text"),
GetSQLValueString(implode(", ", $_POST['INTERESTS']), "text"),
GetSQLValueString($_POST['languages'], "text"),
GetSQLValueString($_POST['ages_served'], "text"),
GetSQLValueString($_POST['treatment_techniques'], "text"),
GetSQLValueString($_POST['geo_location'], "text"),
GetSQLValueString($_POST['memberID'], "int"));



In the case of the DataAssist Update page:

$WA_fieldValuesStr = "".((isset($_POST["DIMENS"]))?$_POST["DIMENS"]:"") ."" . "|" . "".((isset($_POST["INTERESTS"]))?implode(", ", $_POST["INTERESTS"]):"") ."" . "|" . "".((isset($_POST["languages"]))?$_POST["languages"]:"") ."" . "|" . "".((isset($_POST["ages_served"]))?$_POST["ages_served"]:"") ."" . "|" . "".((isset($_POST["treatment_techniques"]))?$_POST["treatment_techniques"]:"") ."" . "|" . "".((isset($_POST["geo_location"]))?$_POST["geo_location"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,'' |',none,''";


The options you selected in the select list are being sent as an array. The implode function is converting the array to a coma separated list.


In the case of an Insert page that is fine, but when on an update page, you need to add custom code to preselect the items in the select list based on the comma separated list in the database.


The following thread has information on how to accomplish that:
showthread.php?t=4045&highlight=in_array

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...