View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Checkbox Group to MySQL db

Thread began 9/03/2009 2:35 pm by Les Crowley | Last modified 9/08/2009 4:48 pm by Les Crowley | 4295 views | 6 replies

Les CrowleyBeta Tester

Jason,

I've decided to try it via DataAssist multiple insert and I've gotten the DA repeat region in place (along with the DW repeat region) and applied the DA Multiple Insert but it's not inserting the checked values into the db... am I missing something?

php:
<?php do { ?>

                                    <?php
    
// RepeatSelectionCounter_1 Begin Loop
    
$RepeatSelectionCounter_1_IterationsRemaining $RepeatSelectionCounter_1_Iterations;
    while(
$RepeatSelectionCounter_1_IterationsRemaining--){
        if(
$RepeatSelectionCounterBasedLooping_1 || $row_artcategories){
?>
                                      <tr>
                                        <td>
<input type="checkbox" name="$galcats_<?php echo $RepeatSelectionCounter_1?>" value="<?php echo $row_artcategories['Category']; ?>" id="$galcats_<?php echo $RepeatSelectionCounter_1?>">
                                        <?php echo $row_artcategories['Category']; ?></td>
                                      </tr>
                                      <?php
    
// RepeatSelectionCounter_1 Begin Alternate Content
    
else{
?>
                                        <tr>
                                          <td>&nbsp;</td>
                                        </tr>
                                        <?php // RepeatSelectionCounter_1 End Alternate Content
        
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
            if(!
$row_artcategories && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining 0;}
            
$row_artcategories mysql_fetch_assoc($artcategories);
        }
        
$RepeatSelectionCounter_1++;
    } 
// RepeatSelectionCounter_1 End Loop
?>
                                    <?php } while ($row_artcategories mysql_fetch_assoc($artcategories)); ?>





php:
<?php

// WA DataAssist Multiple Inserts
if ($_SERVER["REQUEST_METHOD"] == "POST"// Trigger
{
  if (!
session_id()) session_start();
  
$WA_loopedFields = array("$galcats");
  
$WA_connection $rockncom;
  
$WA_table "retailcategories";
  
$WA_redirectURL "";
  
$WA_keepQueryString false;
  
$WA_fieldNamesStr "artcategory";
  
$WA_columnTypesStr "',none,''";
  
$WA_insertIfNotBlank "";
  
$WA_fieldNames explode("|"$WA_fieldNamesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
$WA_connectionDB $database_rockncom;
  
$WA_multipleInsertCounter 0;
  
mysql_select_db($WA_connectionDB$WA_connection);
  while (
WA_AB_checkLoopedFieldsExist($WA_loopedFields$WA_multipleInsertCounter)) {
    if (
$WA_insertIfNotBlank == "" || WA_AB_checkLoopedFieldsNotBlank(array($WA_insertIfNotBlank), $WA_multipleInsertCounter)) {
      
$WA_fieldValuesStr "".WA_AB_getLoopedFieldValue("$galcats"$WA_multipleInsertCounter)  ."";
      
$WA_fieldValues explode("|"$WA_fieldValuesStr);
      
$insertParamsObj WA_AB_generateInsertParams($WA_fieldNames$WA_columns$WA_fieldValues, -1);
      
$WA_Sql "INSERT INTO `" $WA_table "` (" $insertParamsObj->WA_tableValues ") VALUES (" $insertParamsObj->WA_dbValues ")";
      
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
    }
    
$WA_multipleInsertCounter++;
  }
  if (
$WA_redirectURL != "")  {
    if (
$WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      
$WA_redirectURL .= ((strpos($WA_redirectURL'?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    
header("Location: ".$WA_redirectURL);
  }
}
?>

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