Multiple Checkbox Blues

the mail() function

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Wed May 25, 2011 11:20 pm

Multiple Checkbox Blues

Postby Poacher619 » Wed May 25, 2011 11:28 pm


I have been trying to figure this out for some time now and was hoping someone could help me out.

I get all my variables sent but my checkbox options. The data is returned as "array". Anything would be greatly appreciated.


Code: Select all

<form action="" method="post" id="contactform">
    <span id="sprytextfield1">
    <input name="name" type="text" id="name" onSubmit="MM_validateForm('name','','R');return document.MM_returnValue" size="35" maxlength="35" />
    <span class="textfieldRequiredMsg">A value is required.</span></span>
    <p>&nbsp; </p>
    <span id="sprytextfield2">
    <label> Email :
      <input name="email" type="text" id="email" onSubmit="MM_validateForm('email','','RisEmail');return document.MM_returnValue" size="34" maxlength="35" />
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
    <p>&nbsp; </p>
    <span id="sprytextfield3">
    <label>Zip Code:
      <input name="zipcode" type="text" id="zipcode" onSubmit="MM_validateForm('zipcode','','RisNum');return document.MM_returnValue" size="5" maxlength="5" />
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
      Comments:<br />
      <textarea name="comments" id="comments" cols="45" rows="5"></textarea>
  <p> I am interested in...(one or more)</p>
  <p><span id="sprycheckbox1">
    <input type="checkbox" name="interest[ ]" value="coolcell" />
   <input type="checkbox" name="interest[ ]" value="poultry" />
      <input type="checkbox" name="interest[ ]" value="water treatment" />
      Water Treatment</label>
      <input type="checkbox" name="interest[ ]" value="pest control" />
      Pest Control</label>
    <br />
    <br />
    <span class="checkboxMinSelectionsMsg">Minimum number of selections not met.</span><span class="checkboxMaxSelectionsMsg">Maximum number of selections exceeded.</span></span>
         <input type="submit" name="send" id="send" value="Submit" vspace="10px" hspace="40px" />
      <input type="reset" name="Clear" id="Clear" value="Clear" vspace="10px" hspace="10px" />


Code: Select all


   $emailSubject = 'Inquiry';
   $webmaster = '';

   $name = $_POST ['name'];
   $email= $_POST ['email'];
   $zipcode = $_POST ['zipcode'];
   $comments = $_POST ['comments'];
   $interest =$_POST ['interest'];
   $body = <<<EOD

Name: $name <br>
Email: $email <br>
Zip Code: $zipcode <br>
Comments: $comments <br>
Interested in: $interest <br>

   $headers .= "Content-type: text/html\r\n";
   $success = mail($webmaster, $emailSubject, $body, $headers);

   $theResults = <<<EOD
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Information Sent</title>

<p>Thank you for your submission.</p>
<p>You will be contacted soon.</p>
<p><a href="index.html" title="site">Back to sitet</a></p>
echo "$theResults";


New php-forum User
New php-forum User
Posts: 67
Joined: Thu May 19, 2011 6:01 am
Location: India

Re: Multiple Checkbox Blues

Postby bachans » Fri May 27, 2011 1:57 am


Regarding checkbox issues, I have posted before in this forum.
Please check it viewtopic.php?f=2&t=12759#p4379113


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 5 guests