close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


select list array binding doesn't work failed validation

Thread began 6/29/2021 12:47 pm by JBWebWorks | Last modified 7/01/2021 1:46 pm by Ray Borduin | 19 views | 2 replies |


select list array binding doesn't work failed validation

Have a select list as an array interest1[] with the multiple selection allowed. The validation works but the binding of the validated entries doesn't.
Code of the validation

if (isset($_POST["submit1"]) || isset($_POST["submit1_x"])) {
$WAFV_Redirect = "volunteer.php";
$_SESSION['WAVT_volunteer_254_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["name1"]))?$_POST["name1"]:"") . "",false,1);
$WAFV_Errors .= WAValidateEM(((isset($_POST["email1"]))?$_POST["email1"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["interest1"]))?implode(",",$_POST["interest1"]):"") . "",false,3);
$WAFV_Errors .= WAValidateLE(strtolower(((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"")) . "",strtolower($_SESSION['captcha_Security_Code_1']) . "",true,4);

if ($WAFV_Errors != "") {

The binding code of the select list

<select name="interest1[]" size="5" multiple="MULTIPLE">
<option value="" <?php if (!(strcmp("", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Choose Interest</option>
<option value="Fundraising" <?php if (!(strcmp("Fundraising", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Fundraising</option>
<option value="Publicity" <?php if (!(strcmp("Publicity", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Publicity</option>
<option value="Office Assistance" <?php if (!(strcmp("Office Assistance", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Office Assistance</option>
<option value="Food Preparation" <?php if (!(strcmp("Food Preparation", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Food Preparation</option>
<option value="Event Set up/Clean up" <?php if (!(strcmp("Event Set up/Clean up", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Event Set up/Clean up</option>
<option value="Special Occasions" <?php if (!(strcmp("Special Occasions", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Special Occasions</option>
<option value="Fair, Parade Participant" <?php if (!(strcmp("Fair, Parade Participant", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Fair, Parade Participant</option>
<option value="Recruitment" <?php if (!(strcmp("Recruitment", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Recruitment</option>
<option value="Public Speaking" <?php if (!(strcmp("Public Speaking", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Public Speaking</option>
<option value="Bingo Monitoring" <?php if (!(strcmp("Bingo Monitoring", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Bingo Monitoring</option>
<option value="Willing to Help as needed" <?php if (!(strcmp("Willing to Help as needed", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Willing to Help as needed</option>
<option value="Other" <?php if (!(strcmp("Other", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>>Other</option>
Sign in to reply to this post

Ray BorduinWebAssist

Yes, unfortunately the selection code won't work for multiple selections. You can update it manually to fix the issue. You would have to update:

<?php if (!(strcmp("Willing to Help as needed", (ValidatedField("volunteer_254","interest1[]"))))) {echo "selected=\"selected\"";} ?>


<?php if (in_array("Willing to Help as needed",ValidatedField("volunteer_254","interest1"))) {echo "selected=\"selected\"";} ?>

Unfortunately each line will have to be updated manually since the value is static and not from a database.

Sign in to reply to this post
Did this help? Tips are appreciated...


Thanks Ray.

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





Ease of use


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