Jump to content

How to show the result of checkbox in the email?


ken0213

Recommended Posts

I'm having a hard time to show the value of the checkbox in the email.....

The results of the checkbox are showing an "array".

 

Here is part of the html and php code:

 

html:

      <input type="checkbox" name="chkbox[]" value="Product A" />Product A

      <input type="checkbox" name="chkbox[]" value="Product B" />Product B

      <input type="checkbox" name="chkbox[]" value="Product C" />Product C

                               

php:

  $To="[email protected]";

  $Send=$_POST["Email"];

  $subj="Inquiries";

  $msg="Contact Person:"."\t".$_POST["Contact_Person"]."\n"."Email:"."\t\t".$_POST["Email"]."\n"."."Skype:"."\t".$_POST["skype"]."\n"."MSN:"."\t".$_POST["MSN"]."'\n"."Which product you are interested: "."\n".$_POST ['chekbox']."\n\n"."Message:"."\n".$_POST["message"];

 

  echo "Dear ".$_POST["Contact_Person"]."</p>";

 

  $mail_header="From:$Send";

 

  ini_set("SMTP","xxxxxxxxx.net");

 

  $success=mail($To,$subj,$msg,$mail_header);

 

  if($success)

{

 

}else{

echo "<font color='red'>An unexpected error has occurred! Please try again.</p>";

}

?>

The results of the checkbox are showing an "array".

 

Thats because you're storing it as an array (which is used for multiple selections--not sure if that's your intention). Try calling a specific key inside the array (btw...call the name, not the type, and check your spelling) or just define it as a variable instead of an array

 

Make any sense?  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.