close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How do you update an implode dropdown select field with multiple select

Thread began 4/21/2022 5:07 pm by Michael | Last modified 4/25/2022 10:45 am by Ray Borduin | 124 views | 2 replies |

Michael

How do you update an implode dropdown select field with multiple select

Hi,

I have an implode dropdown select field with multiple select. I have been able to setup the insert easily. But now I can't seem to know how to code the field to edit existing record.

When you open the form to edict the existing record, it does not populate the field with existing record. Rather you will have to add the new record as though you are adding it for the first time

This is how the edit dropdown select field is. The "financepln" is the name of the field

<select class="chosen-select" multiple data-placeholder="Select one or more options" name="financepln[]" id="financepln" required style="width:100%; height:35px; font-size:14px; border:#EEE thin solid; background-color:#FFF; text-align:left;">
<option value="" <?php if (!(strcmp("", ($rsMyProfile->getColumnVal("financepln"))))) {echo "selected=\"selected\"";} ?>></option>
<option value="Mortgage/Bank Loan" <?php if (!(strcmp("Mortgage/Bank Loan", ($rsMyProfile->getColumnVal("financepln"))))) {echo "selected=\"selected\"";} ?>>Mortgage/Bank Loan</option>
<option value="Private Source" <?php if (!(strcmp("Private Source", ($rsMyProfile->getColumnVal("financepln"))))) {echo "selected=\"selected\"";} ?>>Private Source</option>
</select>

Please kindly help.

Thank you

Sign in to reply to this post

Ray BorduinWebAssist

You have to use explode() to get the values back into an array and see what was selected like:

php:
<?php

$selArray 
explode(",",$rsMyProfile->getColumnVal("financepln"));  
?>
<select class="chosen-select" multiple data-placeholder="Select one or more options" name="financepln[]" id="financepln" required style="width:100%; height:35px; font-size:14px; border:#EEE thin solid; background-color:#FFF; text-align:left;">
<option value="Mortgage/Bank Loan" <?php if (in_array("Mortgage/Bank Loan"$selArray)) {echo "selected=\"selected\"";} ?>>Mortgage/Bank Loan</option>
<option value="Private Source" <?php if (in_array("Private Source"$selArray)) {echo "selected=\"selected\"";} ?>>Private Source</option>
</select>
Sign in to reply to this post
Did this help? Tips are appreciated...

Michael

Originally Said By: Ray Borduin
  You have to use explode() to get the values back into an array and see what was selected like:

php:
<?php

$selArray 
explode(",",$rsMyProfile->getColumnVal("financepln"));  
?>
<select class="chosen-select" multiple data-placeholder="Select one or more options" name="financepln[]" id="financepln" required style="width:100%; height:35px; font-size:14px; border:#EEE thin solid; background-color:#FFF; text-align:left;">
<option value="Mortgage/Bank Loan" <?php if (in_array("Mortgage/Bank Loan"$selArray)) {echo "selected=\"selected\"";} ?>>Mortgage/Bank Loan</option>
<option value="Private Source" <?php if (in_array("Private Source"$selArray)) {echo "selected=\"selected\"";} ?>>Private Source</option>
</select>
  



Thank you so much Sir Ray.

I added it and worked perfectly. However, I have to change one of the options from "Mortgage/Bank Loan" to "Mortgage OR Bank Loan".

The reason being that when I insert "Mortgage/Bank Loan" and try to view, it will display on the page but when I try to edit it on the edit page, it will not populate because of the slash '"/".

When I changed it from "Mortgage/Bank Loan" to "Mortgage OR Bank Loan", everything went well.

Sign in to reply to this post

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...