Can some one help my butt out that why I only get one check box out of the 4 to show up in my email to myself when a user hits submit? When ever I check box any email I only get the bottom check box to show up in my return email. I need to ahppen is that when anyonechecks anybox the email will return all data and what boxes where checked i Its been a long time any help and how i don this would be sooo greatful. thanks. I have been at it for 2 days and arrays are just killing me right now when its the last thing i need.

Inline Code Example Here

<?php

$to = 'adeligio@gmail.com';
$subject = 'Comming in hot';

$Fristname = $_POST ['FristName'];
$Lastname = $_POST ['LastName'];
$Phonenumber = $_POST ['Phonenumber'];
$Emailaddress = $_POST ['Emailaddress'];
$Location = $_POST ['Location'];
// Check Boxes
$Project = $_POST ['Project'];
if(is_array($Project))

$Comments = $_POST ['Comments'];

$body = <<<Email
<br><hr><br>
Email: $Fristname <br>

Last name: $Lastname <br>

Phone Number: $Phonenumber <br>

Email Address: $Emailaddress <br>

Location: $Location <br>

Project Type: $Project <br>

Comments: $Comments <br>

Email;
if($_POST){
    $headers .= "Content-type: text/html\r\n";
    $success = mail ($to,$subject, $body, $headers);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Newport Homes Inc.</title>
<style type="text/css">
body,td,th {
    color: #000;
    font-size: 14px;
}
body {
    background-color: #09F;
    background-repeat: no-repeat;
    color: #666;
}
#LogoHeader {
    position:absolute;
    width:192px;
    height:115px;
    z-index:0;
    left: 94px;
    top: 44px;
    background-color: #FFFFFF;
    background-image: url(file:///Andrew%20HD/Users/Adeligio/Documents/Newport%20Homes/images/Pageformat/Logo.jpg);
}
#Motto {
    font-family: Georgia, Times New Roman, Times, serif;
    color: #FFF;
}
.Wording {
    font-size: medium;
    color: #FFF;
}
#apDiv1 {
    position:absolute;
    width:200px;
    height:113px;
    z-index:1;
    left: 126px;
    top: 22px;
    background-image: url(file:///Andrew%20HD/Users/Adeligio/Documents/Newport%20Homes/images/Pageformat/Logo.jpg);
}
#apDiv2 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 102px;
    top: 26px;
    background-image: url(file:///Andrew%20HD/Users/Adeligio/Documents/Newport%20Homes/images/Pageformat/Logo.jpg);
}
#apDiv3 {
    position:absolute;
    width:127px;
    height:89px;
    z-index:1;
    left: 134px;
    top: 41px;
    background-image: url(file:///Andrew%20HD/Users/Adeligio/Documents/Newport%20Homes/NewSite/Logo2web.jpg);
}
.Wordingcolor {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 12px;
    font-style: normal;
    color: #F93;
}
#form1 table tr th {
    font-size: 12px;
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #000;
}
.froms {
    position: fixed;
    left: auto;
}
</style>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
</head>

<body bgcolor="#000000">
<table width="966" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="966" height="128"><div align="center">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <th width="640" height="10"><img src="../images/newportheader.jpg" width="967" height="154" /></th>
          </tr>
      </table>
    </div></td>
  </tr>
  <tr bgcolor="#8BA0BF">
    <td height="615" valign="top" bgcolor="#0099FF"><div align="center">
      <table width="966" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="659" valign="top" bgcolor="#FFFFFF"><table width="965" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="965" height="30" align="center" valign="middle" bgcolor="#000000"><table width="885" height="23" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <th width="95" scope="col">&nbsp;</th>
                  <th width="95" bgcolor="#000000" class="Wordingcolor" scope="col"><a href="../index.html" class="Wordingcolor">Home</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="../about_us/aboutus.html" class="Wordingcolor">About Us</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="../photos/photos.html" class="Wordingcolor">Photo's</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="../testimonials/testimonials.html" class="Wordingcolor">Testimonials</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="../projects/projects.html" class="Wordingcolor">Projects</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="../news/news.html" class="Wordingcolor">News</a></th>
                  <th width="95" class="Wordingcolor" scope="col"><a href="Contact.php" class="Wordingcolor">Contact Us</a></th>
                  <th width="125" scope="col">&nbsp;</th>
                </tr>
              </table></td>
              </tr>
          </table>
            <table width="951" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="85" bgcolor="#FFFFFF">&nbsp;</td>
                <td width="127" bgcolor="#FFFFFF">&nbsp;</td>
                <td width="105" bgcolor="#FFFFFF"><a href="https://www.facebook.com/pages/Newport_Homes_Inc/200628276644828?sk=info"><img src="../images/facebook.jpg" alt="" width="100" height="31" /></a></td>
                <td width="37" bgcolor="#FFFFFF">&nbsp;</td>
                <td width="100"><img src="../images/google.jpg" alt="" width="100" height="31" /></td>
                <td width="37" bgcolor="#FFFFFF">&nbsp;</td>
                <td width="100"><img src="../images/linked-in.jpg" alt="" width="100" height="31" /></td>
                <td width="37" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
                <td width="100"><img src="../images/twitter.jpg" alt="" width="100" height="31" /></td>
                <td width="192" bgcolor="#FFFFFF">&nbsp;</td>
                <th width="31" height="50" bgcolor="#FFFFFF" scope="col">&nbsp;</th>
                </tr>
      </table>
            <table width="965" height="575" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <th width="944" height="575" valign="top" bgcolor="#FFFFFF" scope="col"><table width="971" border="0">
                  <tr>
                    <th scope="row">Contact Your Chicagoland Builder </th>
                  </tr>
                  <tr>
                    <th scope="row"> The protection of your privacy is important to us at Newport Homes. Rest assured that the personal information you provide us with will not be disclosed to any other parties and will be used solely for the purpose of bringing you the best service possible. </th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table>
                   <form id="ContactForm" name="ContactForm" method="post" action="">
                    <table width="610" border="0" align="left">
                      <tr>
                        <td align="left" bgcolor="#00FFFF">First Name: *</td>
                      </tr>
                      <tr>
                        <td align="left" bgcolor="#FFFFFF"><div align="left"><span id="First">
                        <label for="Frist Name: *"></label>
                        <input name="FristName" type="text" id="FristName" size="75" />
                        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div></td>
                      </tr>
                      <tr>
                        <td width="604"><span id="firstname">
                        <label for="First Name: *"></label>
                        </span></td>
                      </tr>
                      <tr>
                        <td align="left" bgcolor="#00FFFF"><div align="left">Last Name: *</div></td>
                      </tr>
                      <tr>
                        <td align="left" bgcolor="#FFFFFF"><span id="Last">
                        <label for="Last Name: *"></label>
                        <input name="LastName" type="text" id="LastName" size="75" />
                        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                      </tr>
                      <tr>
                        <td bgcolor="#00FFFF"><div align="left">Phone Number: *</div></td>
                      </tr>
                      <tr>
                        <td><div align="left"><span id="Phone">
                        <label for="Phone Number"></label>
                        <input name="Phonenumber" type="text" id="Phonenumber" size="75" />
                        <span class="textfieldRequiredMsg">A value is required.</span></span></div></td>
                      </tr>
                      <tr>
                        <td bgcolor="#00FFFF"><div align="left">Email Address: *</div></td>
                      </tr>
                      <tr>
                        <td align="left"><label for="Email Address"><span id="Email">
                        <input name="Emailaddress" type="text" id="Emailaddress" size="75" />
                        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></label></td>
                      </tr>
                      <tr>
                        <td bgcolor="#00FFFF"><div align="left">Location of Inquire:*</div></td>
                      </tr>
                      <tr>
                        <td align="left"><span id="Location">
                        <label for="Location of Inquire"></label>
                        <input name="Location" type="text" id="Location" size="75" />
                        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                      </tr>
                      <tr>
                        <td bgcolor="#00FFFF"><div align="left">Type of Project:</div></td>
                      </tr>
                      <tr>
                        <td height="89" align="left"><p>
                          <label>
                            <input type="checkbox" name="Project" value="Residential Construction" id="Residential Construction" />
                            Residential Construction</label>
                          <br />
                          <label>
                            <input type="checkbox" name="Project" value="Residential Remodel" id="Residential Remodel" />
                            Residential Remodel</label>
                          <br />
                          <label>
                            <input type="checkbox" name="Project" value="Commercial Construction" id="CommercialConstruction" />
                            Commercial Construction</label>
                          <br />
                          <label>
                            <input type="checkbox" name="Project" value="Commercial Remodel" id="Commercial Remodel" />
                            Commercial Remodel</label>
                          <br />
                        </p></td>
                      </tr>
                      <tr>
                        <td bgcolor="#00FFFF"><div align="left">Comments\Questions:</div></td>
                      </tr>
                      <tr>
                        <td align="left"><span id="Comment">
                          <label for="Comments"></label>
                          <textarea name="Comments" id="Comments" cols="75" rows="5"></textarea>
</span></td>
                      </tr>
                      <tr>
                        <td align="left"><input type="submit" name="Send it to me" id="Send it to me" value="Lets Build!" />
                          <input type="reset" name="Start Over" id="Start Over" value="Start Over" />
                            <input name="Email" type="hidden" id="Email" value="mailto:Adeligio@gmail.com" /></td>
                      </tr>
                    </table>
                  </form></th>
              </tr>
            </table></td>
        </tr>
  </table>
      <p>Copyright @ 2012 Newport Homes Inc. All rights reserved</p>
      <p>&nbsp;</p>
    </div></td>
  </tr>
</table>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("firstname", "custom");
var sprytextfield3 = new Spry.Widget.ValidationTextField("First", "custom");
var sprytextfield2 = new Spry.Widget.ValidationTextField("Last", "custom");
var sprytextarea1 = new Spry.Widget.ValidationTextarea("Comment", {isRequired:false});
var sprytextfield4 = new Spry.Widget.ValidationTextField("Phone", "none");
var sprytextfield5 = new Spry.Widget.ValidationTextField("Email", "email");
var sprytextfield6 = new Spry.Widget.ValidationTextField("Location", "custom");
</script>
</body>
</html>

Recommended Answers

All 7 Replies

Change the name attribute to an array

<input type="checkbox" name="Project[]" value="... />

and all the checked checkboxes should be in $_POST['Project'] which will be an array, too.

// e.g. you can get a list of project (a string) by imploding the array
$Project = implode(', ', $_POST ['Project']);

I hate to say this but HOw do I Change this array again. I have been at this for 2 days And I Am abuot to thorw things today. But I see where you are comming form.

Think I got it but any help would still be great

Sorry, I do not understand the question? Have you tried to change the name attributes for all checkboxes to an array (just adding [] to existing names)?

Just looking at your code: why do you not check for existence of $_POST array elements before assigning them to variables like in $Fristname = $_POST ['FristName'];? This code should return an error. Also what is the purpose of the condition on line 13 if(is_array($Project))? Is any of the code missing?

Thank but I fix it finally. I changed the did Change the $POST and my if else in my array were all jacked. I can post the anser if anyone would like

Maybe you post it so the thread is complete. And if this is it please mark it as solved. Cheers.

here is the answer and redesgin if anyone looking

<?php
if($_POST['submitted'] == "yes"){
    $to = 'adeligio@gmail.com';
    $subject = 'Newport Homes Lead';    
    $Fristname = $_POST ['FristName'];  
    $Lastname = $_POST ['LastName'];
    $Phonenumber = $_POST ['Phonenumber'];  
    $Emailaddress = $_POST ['Emailaddress'];
    $Location = $_POST ['Location'];
    $Comments = $_POST ['Comments'];

    // Check Boxes
    //START added by JDK
    if(is_array($_POST['Project'])){
        foreach($_POST['Project'] as $proj){
            $Project.= $proj."<br/>";
        }
    }
    else{
        $Project = "None Selected";
    }
    //END added by JDK

    $body = '<br><hr><br>';

    $body.= 'First Name: '.$Fristname.' <br>';

    $body.= 'Last name: '.$Lastname.' <br>';

    $body.= 'Phone Number: '.$Phonenumber.' <br>';

    $body.= 'Email Address: '.$Emailaddress.' <br>';

    $body.= 'Location: '.$Location.' <br>';

    $body.= 'Project Type: '.$Project.' <br>';

    $body.= 'Comments: '.$Comments.' <br>';

    if($_POST){
        $headers .= "Content-type: text/html\r\n";
        $success = mail ($to  ,$subject  , $body  , $headers);
    }
}
?>
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.