Multiple Checkbox Blues

the mail() function

Moderators: macek, egami, gesf

Poacher619
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

Hello,

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.

HTML>>>>>>>>>>>>>>

Code: Select all

<form action="http://www.agrecom.net/contact.php" method="post" id="contactform">
  <p>&nbsp;</p>
  Name:
   
   
    <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" />
    </label>
    <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" />
    </label>
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
    <p>&nbsp;</p>
 
    <label>
      Comments:<br />
      <textarea name="comments" id="comments" cols="45" rows="5"></textarea>
    </label>
  </p>
  <p>&nbsp;</p>
  <p> I am interested in...(one or more)</p>
  <p>&nbsp;</p>
  <p><span id="sprycheckbox1">
    <label>
    <input type="checkbox" name="interest[ ]" value="coolcell" />
      Coolcell</label>
    <label>
   <input type="checkbox" name="interest[ ]" value="poultry" />
     Poultry</label> 
    <label>
      <input type="checkbox" name="interest[ ]" value="water treatment" />
      Water Treatment</label>
    <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>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>
    <label>
     
         <input type="submit" name="send" id="send" value="Submit" vspace="10px" hspace="40px" />
    </label>
    <label>
      <input type="reset" name="Clear" id="Clear" value="Clear" vspace="10px" hspace="10px" />
    </label>
  </p>
 
</form>


PHP>>>>>>>>>>>>>>>>

Code: Select all

<?php
error_reporting(E_ALL|E_DEPRECATED);


   $emailSubject = 'Inquiry';
   $webmaster = 'agrecom@agrecom.net';
   
 




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

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


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


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

<body>
<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>
</body>
</html>
EOD;
echo "$theResults";










?>


bachans
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

HI,

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

Thanks
Bachan


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest