Jump to content

Help with Feedback form


bengaluru

Recommended Posts

Can somebody help me with this php.

This is the simplest php form getting feedback from my visitors.  I have the same form on my other site and it is working fine.  But nowworking with my new site.

My form is fine.  I am having trouble with the response.  The problem is that whenever a user completes the form, instead of the "thank you",  the No response page is displayed and no email is received by me.  the page that is displayed (No response) says that the user has not completed all the fields and hence the response is not sent.

---------------------------------------------------------------  This is my php

<?if (($name == "") && ($email == "") && ($comments == "")) {
header("Location: http://www.mysite.com/noresponse.htm");
exit;}


$msg = "E-MAIL SENT FROM $email\n";
$msg .= "Sender's Name: $name\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Sender's Place: $place\n";
$msg .= "Message: $comments\n\n";


$to = "myname@gmail.com";
$subject = " Feedback";
$mailheaders = "From: Response Forms <> \n";
$mailheaders .= "Reply-To: $email\n\n";

mail($to, $subject, $msg, $mailheaders);
?>
<HTML>
<HEAD><TITLE>My site - Thank You</TITLE>
<meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm">
</HEAD>
<BODY>
<p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p>
    <hr>

<H1>Thank you. Your response is valuable to us.</H1>

<P><strong>Your Name:</strong>
<? echo "$name"; ?>
<P><strong>Your E-Mail Address:</strong>
<? echo "$email"; ?>
<P><strong>You are from:</strong>
<? echo "$place"; ?>
<P><strong>Message:</strong>
  <? echo "$comments"; ?>
<H3>Please wait and you will be taken back to the page you were viewing</H3>

</BODY>
</HTML>
-------------------------------------------------------------------------------------------

Any help ?
Link to comment
Share on other sites

[code]
<?php
if (!isset($name) || !isset($email) || !isset($comments)) {
header("Location: http://www.mysite.com/noresponse.htm");
exit;
}else {


$msg = "E-MAIL SENT FROM $email\n";
$msg .= "Sender's Name: $name\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Sender's Place: $place\n";
$msg .= "Message: $comments\n\n";


$to = "myname@gmail.com";
$subject = " Feedback";
$mailheaders = "From: Response Forms <> \n";
$mailheaders .= "Reply-To: $email\n\n";

$send = mail($to, $subject, $msg, $mailheaders);
if($send){
?>
<HTML>
<HEAD><TITLE>My site - Thank You</TITLE>
<meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm">
</HEAD>
<BODY>
<p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p>
 
<H1>Thank you. Your response is valuable to us.</H1>

<P><strong>Your Name:</strong>
<? echo "$name"; ?>
<P><strong>Your E-Mail Address:</strong>
<? echo "$email"; ?>
<P><strong>You are from:</strong>
<? echo "$place"; ?>
<P><strong>Message:</strong>
<? echo "$comments"; ?>
<H3>Please wait and you will be taken back to the page you were viewing</H3>

</BODY>
</HTML>
<?php
}else {
echo "your mail was not delivered";
}
}
?>
[/code]
Link to comment
Share on other sites

No my php is giving errors with your code.  Can U post the exact code that I should be using like you did before.  Thanks so much for your help.

But what I dont understand is the same php works fine in my other site and why does it not work now ?
What am I doing wrong ?
Link to comment
Share on other sites

[code=php:0]
<?php
$name = $_POST[name];
$email = $_POST[email];
$comments = $_POST[comments];
if (!isset($name) || !isset($email) || !isset($comments)) {
header("Location: http://www.mysite.com/noresponse.htm");
exit;
}else {


$msg = "E-MAIL SENT FROM $email\n";
$msg .= "Sender's Name: $name\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Sender's Place: $place\n";
$msg .= "Message: $comments\n\n";


$to = "myname@gmail.com";
$subject = " Feedback";
$mailheaders = "From: Response Forms <> \n";
$mailheaders .= "Reply-To: $email\n\n";

$send = mail($to, $subject, $msg, $mailheaders);
?>
<HTML>
<HEAD><TITLE>My site - Thank You</TITLE>
<meta http-equiv="refresh" content="10;url=http://www.mysite.com/contactus.htm">
</HEAD>
<BODY>
<p><img src="images/banner.jpg" width="446" height="100"><img src="images/shubha.jpg" width="354" height="100"></p>
 
<H1>Thank you. Your response is valuable to us.</H1>

<P><strong>Your Name:</strong>
<? echo "$name"; ?>
<P><strong>Your E-Mail Address:</strong>
<? echo "$email"; ?>
<P><strong>You are from:</strong>
<? echo "$place"; ?>
<P><strong>Message:</strong>
<? echo "$comments"; ?>
<H3>Please wait and you will be taken back to the page you were viewing</H3>

</BODY>
</HTML>
<?php
}
?>
[/code]
Link to comment
Share on other sites

Thanks my friend.  It worked.

One more question : what if I have to get the response at 2 email id's.

right now it says =myname@gmail.com

I tried this - $to = "myname@gmail.com";"yourname@gmail.com";

But it does not work. 

2. for some reason the Place of the sender is not diaplayed both at the thank You page and the email that I receive.  You know why ?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.