Hello everyone,
If you haven't seen my form code so far here it is:

<?php

$host = "xxxxxx";
$username = "xxxxxxx";
$password = "xxxxxxxx";
$database ="xxxxxxxx";
$conn = mysql_connect ($host, $username, $password) or die ("could not connect");
$db = mysql_select_db($database, $conn) or die ("could not select DB");
$id=mysql_real_escape_string($_POST['id']); //This value has to be the same as in the HTML form file
$FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file
$LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file
$FirmName=mysql_real_escape_string($_POST['FirmName']); //This value has to be the same as in the HTML form file
$AttorneyName=mysql_real_escape_string($_POST['AttorneyName']); //This value has to be the same as in the HTML form file
$Phone=mysql_real_escape_string($_POST['Phone']); 
$Email=mysql_real_escape_string($_POST['Email']); 
$ProceedingMonth=mysql_real_escape_string($_POST['ProceedingMonth']);
$ProceedingDay=mysql_real_escape_string($_POST['ProceedingDay']);
$ProceedingYear=mysql_real_escape_string($_POST['ProceedingYear']); 
$ProceedingCity=mysql_real_escape_string($_POST['ProceedingCity']); 
$ProceedingState=mysql_real_escape_string($_POST['ProceedingState']); 
$CaseCaption=mysql_real_escape_string($_POST['CaseCaption']); 
$ProceedingType=mysql_real_escape_string($_POST['ProceedingType']);
$time=mysql_real_escape_string($_POST['time']);
$tzne=mysql_real_escape_string($_POST['tzne']);
$LengthOfDepo=mysql_real_escape_string($_POST['LengthOfDepo']);
$attendees=mysql_real_escape_string($_POST['attendees']);
$acrlocal=mysql_real_escape_string($_POST['acrlocal']);
$OtherAddress=mysql_real_escape_string($_POST['OtherAddress']);
$NoticeDelivery=mysql_real_escape_string($_POST['NoticeDelivery']);
$TransDeliveryRequest=mysql_real_escape_string($_POST['TransDeliveryRequest']);
$TransDeliveryMethod=mysql_real_escape_string($_POST['TransDeliveryMethod']);
$WitnessOrJudgeName=mysql_real_escape_string($_POST['WitnessOrJudgeName']); 
$Reeltime=mysql_real_escape_string($_POST['Reeltime']);
$NeedVideo=mysql_real_escape_string($_POST['NeedVideo']);
$Interpreter=mysql_real_escape_string($_POST['Interpreter']);
$Language=mysql_real_escape_string($_POST['Language']);
$SpecialInstructions=mysql_real_escape_string($_POST['SpecialInstructions']);
$evilblocker=mysql_real_escape_string($_POST['evilblocker']);
$answer="Accurate";
$promocde=mysql_real_escape_string($_POST['promocde']);
$promoanswer="xxxxxx";
$syncpromo=mysql_real_escape_string($_POST['syncpromo']);
$correctanswer="Thank you order has been processed.";
$correctanswer2="You have entered a valid promo code please enjoy our gift to you.";
$wronganswer="You have typed in the wrong information in the Security Image field.";
$all= $send . $answer . $send2;
$promo="your promo code does not match a current promo offer";

//Mails the form to Accurate Court Reporting, Inc (to the production department).
$to = "xxxxx@xxxxx.com";
$subject = "A client has ordered a Videographer/Court Reporter/VideoConferencing";

$message = "A client has placed an order here are the details."."\n" ."\n"."CLIENT INFORMATION:" ."\n"."\n". "SCHEDULING ATTORNEY: ".$AttorneyName ."\n". "FIRM NAME: ".$FirmName . "\n". "CONTACTS FIRST NAME: ".$FirstName ."\n". "CONTACTS LAST NAME: " .$LastName ."\n". "PHONE:" .$Phone ."\n". "EMAIL ADDRESS:" .$Email ."\n"."\n".
                                                                           "CASE INFORMATION:" ."\n"."\n". "CASE CAPTION:".$CaseCaption ."\n"."DEPONENT:".$WitnessOrJudgeName ."\n"."DATE OF DEPOSITION:" .$ProceedingMonth." ".$ProceedingDay." ".$ProceedingYear ."\n"."TIME OF DEPOSITION:".$time." ,".$tzne ."\n"."ESTIMATED LENGTH OF DEPOSITION: ".$LengthOfDepo ."\n"."\n"."NUMBER OF ATTENDEES: ".$attendees ."\n"."\n"."LOCATION OF DEPOSITION: ".$acrlocal ."\n"."\n"."ADDRESS IF NOT AN ACR, INC. LOCATION: ".$OtherAddress ."\n"."NOTICE OF DEPOSITION SENT VIA: ".$NoticeDelivery ."\n"."\n".  
                                                                           "PRODUCTION INFORMATION:" ."\n"."\n". "TRANSCRIPT DELIVERY DATE: ".$TransDeliveryRequest ."\n". "TRANSCRIPT DELIVERY METHOD:".$TransDeliveryMethod ."\n"."\n".
                                                                           "SPECIAL SERVICES NEEDED:" ."\n"."\n". "REALTIME NEEDED: ".$Reeltime ."\n". "VIDEOGRAPHER NEEDED: ".$NeedVideo ."\n". "INTERPRETER NEEDED: ".$Interpreter ."\n". "INTERPRETER LANGUAGE: ".$Language ."\n". "PROMO CODE: ".$promocde ."\n". "ADDITIONAL COMMENTS:".$SpecialInstructions;

$from = trim($_POST['Email']); # removing spaces from the beginning and end of the string2.
$from = filter_var($from,FILTER_VALIDATE_EMAIL);
$header1= "From: Accurate Court Reporting, Inc.";
$subject1 = "You have placed an order with Accurate Court Reporting, Inc.";
$autoreply = "You have placed an order with Accurate Court Reporting, Inc. here are the details."."\n" ."\n"."CLIENT INFORMATION:" ."\n"."\n". "SCHEDULING ATTORNEY: ".$AttorneyName ."\n". "FIRM NAME: ".$FirmName . "\n". "CONTACTS FIRST NAME: ".$FirstName ."\n". "CONTACTS LAST NAME: " .$LastName ."\n". "PHONE:" .$Phone ."\n". "EMAIL ADDRESS:" .$Email ."\n"."\n".
                                                                           "CASE INFORMATION:" ."\n"."\n". "CASE CAPTION:".$CaseCaption ."\n"."DEPONENT:".$WitnessOrJudgeName ."\n"."DATE OF DEPOSITION:" .$ProceedingMonth." ".$ProceedingDay." ".$ProceedingYear ."\n"."TIME OF DEPOSITION:".$time." ,".$tzne ."\n"."ESTIMATED LENGTH OF DEPOSITION: ".$LengthOfDepo ."\n"."\n"."NUMBER OF ATTENDEES: ".$attendees ."\n"."\n"."LOCATION OF DEPOSITION: ".$acrlocal."\n"."\n"."ADDRESS IF NOT AN ACR, INC. LOCATION: ".$OtherAddress ."\n"."NOTICE OF DEPOSITION SENT VIA: ".$NoticeDelivery ."\n"."\n".  
                                                                           "PRODUCTION INFORMATION:" ."\n"."\n". "TRANSCRIPT DELIVERY DATE: ".$TransDeliveryRequest ."\n". "TRANSCRIPT DELIVERY METHOD:".$TransDeliveryMethod ."\n"."\n".
                                                                           "SPECIAL SERVICES NEEDED:" ."\n"."\n". "REALTIME NEEDED: ".$Reeltime ."\n". "VIDEOGRAPHER NEEDED: ".$NeedVideo ."\n". "INTERPRETER NEEDED: ".$Interpreter ."\n". "INTERPRETER LANGUAGE: ".$Language ."\n". "PROMO CODE: ".$promocde."\n". "ADDITIONAL COMMENTS:".$SpecialInstructions;


$sql="INSERT INTO ACRSchedule (AttorneyName,FirmName,FirstName,LastName,Phone,Email,CaseCaption,WitnessOrJudgeName,ProceedingMonth,ProceedingDay,ProceedingYear,time,tzne,LengthOfDepo,attendees,acrlocal,OtherAddress,NoticeDelivery,TransDeliveryRequest,TransDeliveryMethod,Reeltime,NeedVideo,Interpreter,Language,promocde,SpecialInstructions,evilblocker,syncpromo,hereabt,other) VALUES ('$AttorneyName','$FirmName','$FirstName','$LastName','$Phone','$Email','$CaseCaption','$WitnessOrJudgeName','$ProceedingMonth','$ProceedingDay','$ProceedingYear','$time','$tzne','$LengthOfDepo','$attendees','$acrlocal','$OtherAddress','$NoticeDelivery','$TransDeliveryRequest','$TransDeliveryMethod','$Reeltime','$NeedVideo','$Interpreter','$Language','$promocde','$SpecialInstructions','$evilblocker','$syncpromo','$hereabt','$other')"; 
//echo $sql;
if (!mysql_query($sql,$conn)) {
 die('Error: ' . mysql_error()); 
}

if ($promocde == "$promoanswer")
    { echo $correctanswer2;
    }
    if ($evilblocker == "$all") 
    {echo $correctanswer; 
    $send = mail($to,$subject,$message);
    $send2 = mail($from,$header1,$subject1,$autoreply);
    }
    else
{echo $wronganswer; }

mysql_close($conn);

?>

My question is, I'm trying to parse my checkbox information, which for the sake of argument is the field called: 'Interpreter'. Whenever I recieve the information, I'm not recieving all of the checked boxes, only the last checked box on the list displays in my email.

I've actually tried to google this information and I have found nothing.
Any help is greatly appreciated.
Thanks.

Recommended Answers

All 8 Replies

I'm not recieving all of the checked boxes

What's the HTML for these?

<input type="checkbox" name="Interpreter" value="Person1">Person 1<br />
<input type="checkbox" name="Interpreter" value="Person2">Person 2<br />
<input type="checkbox" name="Interpreter" value="Person3">Person 3<br />
<input type="checkbox" name="Interpreter" value="Other">Other<br />

Hope this helps

That means that $_POST['Interpreter'] is an array, not a single value. It needs to be handled differently. Just check some boxes and output the following to see what it contains:

print_r($_POST['Interpreter']);

priteas,
I replaced:

$Interpreter=mysql_real_escape_string($_POST['Interpreter']);

with

$Interpreter=print_r($_POST['Interpreter']);

and when its parses, it says: "OtherThank You Your Order Has Been Processed."
Any idea on whats causing this?

I did not say replace... that doesn't work. Interpreter is an array, so it can contain multiple values, you cannot assign it to a single variable and use it in a query like that.

pritaeas, I still did the test and the only value displaying is the last one. "Other". Maybe its the HTML?

Of course... missed it...

<input type="checkbox" name="Interpreter[]" value="Person1">Person 1<br />
<input type="checkbox" name="Interpreter[]" value="Person2">Person 2<br />
<input type="checkbox" name="Interpreter[]" value="Person3">Person 3<br />
<input type="checkbox" name="Interpreter[]" value="Other">Other<br />

Pritaeas,
I believe the information is parsing through, but the interpreter field is still blank when I recieve the email.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.