close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Checkboxes to an Array then retreiving results.

Thread began 9/09/2015 3:43 pm by The Flying Fox | Last modified 9/10/2015 6:04 pm by Ray Borduin | 225 views | 2 replies |

The Flying Fox

Checkboxes to an Array then retreiving results.

Hi All,

I have looked through the forum but cannot find an answer for this one using MySqli.

I hve a form that the user fills in one of the questions is

How Long have you been coming to our even?

I have a list of check boxes from a recordset for the year 2000 to the present.

I can successfully input this array into my database but I cannot get it to update to my update page.

so if the user selects

2000,2001,2011,2012,2013,2014,2015

how is this reflected in the user page

I have used a variation on the following

<?php while(!$rsYears->atEnd()) { ?>
<label>
<input type="checkbox"
name="cbAttendedYear[]"
value="<?php echo($rsYears->getColumnVal("year_value")); ?>"
<?php if ((in_array($rsYears->getColumnVal("year_value"), explode(", ", $rsTraders->getColumnVal("trader_Years"))))) {echo "checked=\"checked\"";} ?>
id="cbAttendedYear_<?php echo($rsYears->getColumnVal("yearID")); ?>"><?php echo($rsYears->getColumnVal("year_value")); ?></label>
<?php
$rsYears->moveNext();
}
$rsYears->moveFirst();
?>

I am not sure how to fill the check boxes if a user has saved this info

Thanks

Andy

Sign in to reply to this post

Ray BorduinWebAssist

It looks like that would work. They don't get checked with that code? Is it stored in the database with a comma or comma space? Maybe that is the issue? It is hard to say, but the code looks like it would work to me.

Sign in to reply to this post

The Flying Fox

Hi Ray,

Found the issue, there was no SPACE after the comma when saving to the database table. It is working fine now.

Thanks

Andy

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