Can anyone please help!!!! I have been fighting this for 4 days now. The section with the list of checkboxes named: interest[] will only enter in my database table the last checkbox that the user selects. It won't transfer all the checked interests that they select. (only the last). Is there a code that I'm missing or what is the problem. Also, if someone wants to help me on one more thing, the second email string when the form is submitted, sends out 2 emails - one has the information in it and the other is left blank. Any help????????
BELOW IS THE .PHP SCIPT AND THE NEXT POSTING IS THE HTML SCRIPT......>>>>>
<?php require_once('Connections/smarthomes.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Contact1")) {
$insertSQL = sprintf("INSERT INTO Contact1 (`Contact By`, `Project Location`, `Project Type`, `Number Of Bedrooms`, `Number Of Bathrooms`, `Square Footage`, `Interested In`, `First Name`, `Last Name`, Address, City, `State`, Zip, `Email Address`, `Home Phone#`, `Personal Info Authorization`, `Alternate Phone#`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['ContactBy'], "text"),
GetSQLValueString($HTTP_POST_VARS['ProjectLocation'], "text"),
GetSQLValueString($HTTP_POST_VARS['Typeofproject'], "text"),
GetSQLValueString($HTTP_POST_VARS['Bedrooms'], "int"),
GetSQLValueString($HTTP_POST_VARS['Bathrooms'], "int"),
GetSQLValueString($HTTP_POST_VARS['Squarefootage'], "int"),
GetSQLValueString($HTTP_POST_VARS['interest'], "text"),
GetSQLValueString($HTTP_POST_VARS['FirstName'], "text"),
GetSQLValueString($HTTP_POST_VARS['LastName'], "text"),
GetSQLValueString($HTTP_POST_VARS['Address'], "text"),
GetSQLValueString($HTTP_POST_VARS['City'], "text"),
GetSQLValueString($HTTP_POST_VARS['State'], "text"),
GetSQLValueString($HTTP_POST_VARS['Zip'], "int"),
GetSQLValueString($HTTP_POST_VARS['Email'], "text"),
GetSQLValueString($HTTP_POST_VARS['HomePhone'], "int"),
GetSQLValueString($HTTP_POST_VARS['Authorization'], "text"),
GetSQLValueString($HTTP_POST_VARS['AlternatePhone'], "int"));
mysql_select_db($database_smarthomes, $smarthomes);
$Result1 = mysql_query($insertSQL, $smarthomes) or die(mysql_error());
}
?>
<?php
mail($Email, "Your Request", "Thank you for submitting your request. You will be contacted within the next 24-48 hours. \r\n
\r\n\r\n\r\n
---------------------------------------------------------------------------------------------------------------------------------
You have recieved this email by submitting a contact form at: [url]http://www.nevadasmarthomes.com[/url]
---------------------------------------------------------------------------------------------------------------------------------\r\n".
"From: [email]sales@nevadasmarthomes.com[/email]\r\n".
"Reply-To: [email]sales@nevadasmarthomes.com[/email]\r\n".
"Return-Path: [email]sales@nevadasmarthomes.com[/email]\r\n");
?>
<?php
mail("sales@gspotracing.com", "Submitted Contact for [url]www.Nevadasmarthomes.com[/url]", "
-----------------------------------------------------------------------------------------------------------
The following is the clients personal information, submitted at [url]http://www.nevadasmarthomes.com:[/url]
-----------------------------------------------------------------------------------------------------------\r\n
First Name: $FirstName\r\n
LastName: $LastName\r\n
Address: $Address\r\n
City: $City, State: $State, Zip: $Zip\r\n
Email: $Email\r\n
Home Phone#: $HomePhone\r\n
Alternate Phone#: $AlternatePhone\r\n
Please Contact me by: $ContactBy\r\n
Project Location: $ProjectLocation\r\n
Project Type: $Typeofproject\r\n
My home/office has this many bedrooms: $Bedrooms\r\n
My home/office has this many Bathrooms: $Bathrooms\r\n
My home/office is approximately this many square feet: $Squarefootage\r\n
I'm interested in: $interest\r\n
Authorization of use of personal information: $Authorization\r\n");
?>
😕 😕 😕