Feedback Form Not Sending Comments

I have a Feedback form that send me via email the name, email, company name, and comment every comes in the email but does not send the contents of the Comment field.
I can’t find the problem but I’m sure it’s in the form somewhere… :smiley:

Thanks

[php]

:: Computek Solutions can make your IT problems go away. ::
<?php include "includes/banner.php";?>

Contact information



CompuTek Solutions LLC.
2625 Honeyhill Ct.
Cincinnati, Ohio 45236


Phone: 513-891-4096
Fax: 513-563-2527
Email: [email protected]

Location Map



View Larger Map

Feedback Form

<?php
			if(isset($_GET['sent']) && $_GET['sent'] == '0')
			{
				?>
			<div id="notsent"><span style="color:#FFF">Your comments has not been  sent!</span></div>
				<?php
			}
			if(isset($_GET['sent']) && $_GET['sent'] == '1')
			{
				?>
			<div id="sent">Your comments has been  sent! Thank you for your time.</div>
				<?php
			}
			if(isset($_GET['sent']) && $_GET['sent'] == '2')
			{
				?>
			<div  id="invalidcode"><span style="color:#FFF">Please re-enter the number code</span></div>
				<?php
			}
			
			
			?>

Comments:






<?php include "includes/footer.php";?> [/php]

Where is the code that actually sends the e-mail?

response.php

[php]<?PHP

session_start();

include (‘globals.php’);
$fname = $_REQUEST[‘fname’] ;
$email = $_REQUEST[‘email’] ;
$phone = $_REQUEST[‘phone’] ;
$company = $_REQUEST[‘company’] ;
$comments = $_REQUEST[‘details’] ;

if (md5($_REQUEST[‘code_check’])==$_COOKIE[$site_cookie_verifyimage_name]) {

unset($_SESSION['fname']);
unset($_SESSION['email']);
unset($_SESSION['phone']);
unset($_SESSION['company']);
unset($_SESSION['details']);

// multiple recipients

//ini_set(“SMTP”,“192.168.0.40”);

$to = ‘[email protected]’ . ', '; // add additional mail receipient here. Uncomment to activate

//$to .= ‘[email protected]’ . ', '; // add additional mail receipient here. Uncomment to activate

//$to .= ‘[email protected]’; // add additional mail receipient here

// subject

$subject = 'You have received a mail from ‘.$fname.’ '.$lname; //Modify the mail subject here

//$subject = ‘Message from ‘.$name.’ via domain.dom’;

// message

$message = ’

<tr>

  <td width="434" height="22">Full  Name:</td>

  <td width="779" height="22">'.$fname.'</td>
 <tr>

  <td width="434" height="22">Email:</td>

  <td height="22">'.$email.'</td>

</tr>

 <tr>

   <td height="22">Phone No:</td>

   <td height="22">'.$phone.'</td>

 </tr>

 <tr>

   <td height="22">Company Name:</td>

   <td height="22">'.$company.'</td>

 </tr>
 <tr>

   <td height="22">Comments:</td>

   <td height="22">'.$details.'</td>

 </tr>

 </table>';

// To send HTML mail, the Content-type header must be set

$headers = ‘MIME-Version: 1.0’ . “\r\n”;

$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;

// Additional headers

$headers .= ‘From: ‘.$fname.’ <’.$email.’>’. “\r\n”;

//$headers .= ‘Cc: [email protected]’. “\r\n”; // Add cc recepient here. Uncomment to activate

//$headers .= ‘Cc: [email protected]’. “\r\n”; // Add next cc recepient here. Uncomment to activate

//$headers .= ‘Bcc: [email protected]’. “\r\n”; // Add bcc recepient here. Uncomment to activate

// Replace apostrophe character

$message = str_replace("’","’",$message);

// Mail it now

if(mail($to, $subject, $message, $headers)){

	header( "Location: contact.php?sent=1");

	}else{

	header( "Location: contact.php?sent=0");

	}

} else {

header( “Location: contact.php?sent=2”);

}

?>[/php]

value.js
[php]// JavaScript Document
$(document).ready(function(){
//Name
$("#fname").click(function(){
if($.trim($(this).val())==“Full Name”){
$(this).val("");
}
});
$("#fname").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Full Name”);
}
});

//email
$("#email").click(function(){
if($.trim($(this).val())==“Email Address”){
$(this).val("");
}
});
$("#email").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Email Address”);
}
});

//date
$("#phone").click(function(){
if($.trim($(this).val())==“Phone No”){
$(this).val("");
}
});
$("#phone").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Phone No”);
}
});

//Address
$("#company").click(function(){
if($.trim($(this).val())==“Company Name”){
$(this).val("");
}
});
$("#company").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Company Name”);
}
});

//City Name
$("#city").click(function(){
if($.trim($(this).val())==“Your City”){
$(this).val("");
}
});
$("#city").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Your City”);
}
});

//City Name
$("#position").click(function(){
if($.trim($(this).val())==“Position Applied For”){
$(this).val("");
}
});
$("#position").blur(function(){
if($.trim($(this).val())==""){
$(this).val(“Position Applied For”);
}
});

//Message
$("#comments").click(function(){
if($.trim($(this).text())==“Type in any comments here”){
$(this).text("");
}
});
$("#comments").blur(function(){
if($.trim($(this).text())==""){
$(this).text(“Type in any comments here”);
}
});
});[/php]

I can’t see anything that would prevent it from working. When you receive the e-mail, do all the fields appear correctly? Also, have you tried the form yourself to check that the data is sent?

This is what I get via email as a test.

Full Name: Toby
Email: [email protected]
Phone No: (513) 498-7461
Company Name: N/A
Comments:

You use:

[php]$comments = $_REQUEST[‘details’] ;[/php]

But then use the variable $details for the comments. When you’re developing PHP, it’s a good idea to have ALL errors on so that you would see (in this case) a warning that the $details variable hasn’t been set. That would then enable you to look for why it wasn’t set and find the problem. You can either change the setting in your php.ini file or put this at the top of your script(s):

[php]error_reporting(E_ALL);[/php]

I see where the following is in the response.php $comments = $_REQUEST[‘details’] ;
But not sure where the variable $details is located.

I also added the following in the php file(s) error_reporting(E_ALL); but I get no errors?..

Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service