close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Survey From Repeat Region Script

Thread begun 8/29/2013 10:27 am by bill173836 | Last modified 8/30/2013 7:01 am by Jason Byrnes | 389 views | 1 replies |

bill173836

Survey From Repeat Region Script

I'm trying to make a survey form and I've written a script that displays the survey correctly but I'm not sure how or if I can use DataAssist to get the values into the database. I've sent the simple script and you can see it displayed at http://www.awinninglook.info/surveytest.php. The database has a field called surveyanswerVotes and I want to add to existing values whenever the checkbox is checked for that field but not when it isn't. I've done this on a poll script and that worked but building it so the form displayed multiple questions instead of one made what I did before unusable. Any help is appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

instead of dynamically naming the checkbox, set it to be a checkbox group that uses the same name for each one
<input type="checkbox" name="surveyAnswers[]"....


adding the square brackets at the end of the name "surveyAnswers[]" causes the checkbox to submit the selections as an array.

use the following code at line 1 to convet the array top a comma seperated list:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>




and in the Inser record server behavior, use the following code to bind the surveyanswerVotes column to the surveyAnswers form element:

php:
<?php echo((isset($_POST["surveyAnswers"]))?$_POST["surveyAnswers"]:""?>
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...