I am attempting to submit a form that includes multiple check boxes for one data field. I have set it up the implode the data and make it a comma delimited array. I am able to echo the results, yet I have not been able to post the information to the database. I believe that I have just one simple thig to do, yet I am not being successful. Here is my code I have attached the .txt file also:
<?php require_once('Connections/rotarysantarosa.php'); ?>
<?php
if (isset($_POST['submit']))
{
if (isset($_POST['currentClubPosition']))
{
$strcurrentClubPosition = implode(",", $_POST['currentClubPosition']);
}
else
{
$strcurrentClubPosition = "";
}
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmMemberInsert")) {
$insertSQL = sprintf("INSERT INTO members (firstName, lastName, photo, pastPresident, currentClubPosition, classification, workPosition, company, workAddress, workCity, workState, workZip, officePhone, fax, homePhone, cellPhone, email, website, homeAddress, homeCity, homeState, homeZip, birthdayMonth, birthdayDay, spouse, yearJoined) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['firstName'], "text"),
GetSQLValueString($_POST['lastName'], "text"),
GetSQLValueString($_POST['photo'], "text"),
GetSQLValueString($_POST['pastPresident'], "text"),
GetSQLValueString($_POST['currentClubPosition'], "text"),
GetSQLValueString($_POST['classification'], "text"),
GetSQLValueString($_POST['workPosition'], "text"),
GetSQLValueString($_POST['company'], "text"),
GetSQLValueString($_POST['workAddress'], "text"),
GetSQLValueString($_POST['workCity'], "text"),
GetSQLValueString($_POST['workState'], "text"),
GetSQLValueString($_POST['workZip'], "text"),
GetSQLValueString($_POST['officePhone'], "text"),
GetSQLValueString($_POST['fax'], "text"),
GetSQLValueString($_POST['homePhone'], "text"),
GetSQLValueString($_POST['cellPhone'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['website'], "text"),
GetSQLValueString($_POST['homeAddress'], "text"),
GetSQLValueString($_POST['homeCity'], "text"),
GetSQLValueString($_POST['homeState'], "text"),
GetSQLValueString($_POST['homeZip'], "text"),
GetSQLValueString($_POST['birthdayMonth'], "text"),
GetSQLValueString($_POST['birthdayDay'], "int"),
GetSQLValueString($_POST['spouse'], "text"),
GetSQLValueString($_POST['yearJoined'], "int"));
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$Result1 = mysql_query($insertSQL, $rotarysantarosa) or die(mysql_error());
$insertGoTo = "members.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsStates = "SELECT * FROM states ORDER BY stateName ASC";
$rsStates = mysql_query($query_rsStates, $rotarysantarosa) or die(mysql_error());
$row_rsStates = mysql_fetch_assoc($rsStates);
$totalRows_rsStates = mysql_num_rows($rsStates);
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsMemberInsert = "SELECT * FROM members ORDER BY lastName ASC";
$rsMemberInsert = mysql_query($query_rsMemberInsert, $rotarysantarosa) or die(mysql_error());
$row_rsMemberInsert = mysql_fetch_assoc($rsMemberInsert);
$totalRows_rsMemberInsert = mysql_num_rows($rsMemberInsert);
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsClubPosition = "SELECT * FROM clubpositions ORDER BY `Club Position` ASC";
$rsClubPosition = mysql_query($query_rsClubPosition, $rotarysantarosa) or die(mysql_error());
$row_rsClubPosition = mysql_fetch_assoc($rsClubPosition);
$totalRows_rsClubPosition = mysql_num_rows($rsClubPosition);
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsClassification = "SELECT * FROM classifications ORDER BY Classification ASC";
$rsClassification = mysql_query($query_rsClassification, $rotarysantarosa) or die(mysql_error());
$row_rsClassification = mysql_fetch_assoc($rsClassification);
$totalRows_rsClassification = mysql_num_rows($rsClassification);
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsBirthMonth = "SELECT * FROM birthdaymonth";
$rsBirthMonth = mysql_query($query_rsBirthMonth, $rotarysantarosa) or die(mysql_error());
$row_rsBirthMonth = mysql_fetch_assoc($rsBirthMonth);
$totalRows_rsBirthMonth = mysql_num_rows($rsBirthMonth);
mysql_select_db($database_rotarysantarosa, $rotarysantarosa);
$query_rsBirthDay = "SELECT * FROM birthdayday ORDER BY birthdayday ASC";
$rsBirthDay = mysql_query($query_rsBirthDay, $rotarysantarosa) or die(mysql_error());
$row_rsBirthDay = mysql_fetch_assoc($rsBirthDay);
$totalRows_rsBirthDay = mysql_num_rows($rsBirthDay);
?>
[attachment deleted by admin]