repeat region insert
hi there,
I am trying to get a basic checklist working on the system however when you click the submit button it passes the answers into the url but does not insert to database. form code:
<form action="" method="post" name="checklist">
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsChecklist){
?>
<table>
<?php do { ?>
<tr>
<td>Question: <?php echo $row_rsChecklist['QuestionName']; ?></td>
<td><?php
// RepeatSelectionCounter_2 Begin Loop
$RepeatSelectionCounter_2_IterationsRemaining = $RepeatSelectionCounter_2_Iterations;
while($RepeatSelectionCounter_2_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_2 || $row_rsChecklist){
?>
<input name="Answer_<?php echo $RepeatSelectionCounter_1; ?>_<?php echo $RepeatSelectionCounter_2; ?>" type="checkbox" value="" />
<input name="QuestionID_<?php echo $RepeatSelectionCounter_1; ?>_<?php echo $RepeatSelectionCounter_2; ?>" type="hidden" value="<?php echo $row_rsChecklist['QuestionID']; ?>" />
<input name="clients_ClientID_<?php echo $RepeatSelectionCounter_1; ?>_<?php echo $RepeatSelectionCounter_2; ?>" type="hidden" value="" />
<?php
} // RepeatSelectionCounter_2 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_2 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_2 && $RepeatSelectionCounter_2_IterationsRemaining != 0){
if(!$row_rsChecklist && $RepeatSelectionCounter_2_Iterations == -1){$RepeatSelectionCounter_2_IterationsRemaining = 0;}
$row_rsChecklist = mysql_fetch_assoc($rsChecklist);
}
$RepeatSelectionCounter_2++;
} // RepeatSelectionCounter_2 End Loop
?>
</td>
</tr>
<?php } while ($row_rsChecklist = mysql_fetch_assoc($rsChecklist)); ?>
</table>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsChecklist && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsChecklist = mysql_fetch_assoc($rsChecklist);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<input name="Submit" type="submit" value="1" />
</form>
php:
<?php
// WA DataAssist Multiple Inserts
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
if (!session_id()) session_start();
$WA_loopedFields = array("");
$WA_connection = $cbank;
$WA_table = "checklistanswers";
$WA_redirectURL = "login.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "question_QuestionID|Answer|clients_ClientID";
$WA_columnTypesStr = "none,none,NULL|',none,''|none,none,NULL";
$WA_insertIfNotBlank = "";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_cbank;
$WA_multipleInsertCounter = 0;
mysql_select_db($WA_connectionDB, $WA_connection);
while (WA_AB_checkMultiInsertLoopedFieldsExist($WA_loopedFields, $WA_multipleInsertCounter)) {
if ($WA_insertIfNotBlank == "" || WA_AB_checkLoopedFieldsNotBlank(array($WA_insertIfNotBlank), $WA_multipleInsertCounter)) {
$WA_fieldValuesStr = "".((isset($_GET["QuestionID"]))?$_GET["QuestionID"]:"") ."" . "|" . "".((isset($_GET["Answer"]))?$_GET["Answer"]:"") ."" . "|" . "".$_GET['ClientID'] ."";
$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);
}
}
?>
<?php
// RepeatSelectionCounter_1 Initialization
$RepeatSelectionCounter_1 = 0;
$RepeatSelectionCounterBasedLooping_1 = false;
$RepeatSelectionCounter_1_Iterations = "1";
?>
<?php
// RepeatSelectionCounter_2 Initialization
$RepeatSelectionCounter_2 = 0;
$RepeatSelectionCounterBasedLooping_2 = false;
$RepeatSelectionCounter_2_Iterations = "1";
?>
I have not used webassist products for a while as I found I could not get things working and would like to use this to build a survey. if I could get this working it would help me consider upgrading to data bridge possibly but for some reason my data assist is not working with the insert?
thanks