Jump to content

Help Need to write feedback form


coolbud_php

Recommended Posts

sendmail.php:

--------------

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Sendemail</title>
</head>
<body>
<?php
$ip = $_POST['ip']; 
$httpref = $_POST['httpref']; 
$httpagent = $_POST['httpagent']; 
$name = $_POST['contact_name'];
$subject = $_POST['contact_subject'];
$mailid = $_POST['contact_mail'];
$message = $_POST['contact_message'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(mailid=="" && (!strstr($mailid,"@") || !strstr($mailid,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($mailid) || empty($name) || empty($message))
{
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! "); 
}
$todayis = date("l, F j, Y, g:i a") ;

$message = stripcslashes($message);

$message = " $todayis [EST] \n
Message: $message \n 
From: $name ($mailid)\n
Additional Info : \n
IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $mailid\r\n";
$mail_sent = @mail("[email protected]", $subject, $message, $from);
if($mail_sent)
{
include("thankyou.html");
}
else
{
include("fail.html");
}
?>
</body>
</html>

 

i called this php file from feedback.php, the code of feedback.php file is;

<form name="feedback" method="post" action="sendmail.php" onsubmit = "return ValidateForm(this)">
	<!-- DO NOT change ANY of the php sections -->
	<?php
	$ipi = getenv("REMOTE_ADDR");
	$httprefi = getenv ("HTTP_REFERER");
	$httpagenti = getenv ("HTTP_USER_AGENT");
	?>
	<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
	<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
	<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

        <h1 class="block">Feedback</h1>
        <div class="column1-unit">
          <p>
	  <fieldset>
			<br/>
		<p><label for="contact_name" class="left">   Name: </label>
                   <input type="text" name="contact_name" id="contact_name" class="field" value="" tabindex="4" /></p>
                <p><label for="contact_subject" class="left">   Subject: </label>
                   <input type="text" name="contact_subject" id="contact_subject" class="field" value="" tabindex="4" /></p>
			<p><label for="contact_subject" class="left"> <font color="RED">*</font> E-Mail:    </label>
                   <input type="text" name="contact_mail" id="contact_mail" class="field" value="" tabindex="4" /></p>                
                <p><label for="contact_message" class="left">   Message:</label>
                   <textarea name="contact_message" id="contact_message" cols="45" rows="10"tabindex="5"></textarea></p>
                <p><input type="submit" name="submit" id="submit" class="button" value="Send message" tabindex="4" /></p>
              </fieldset>

	  </p>
	        </div>   
        </form>

 

but it is not working what may be the error,it won't throw error too.plz help me.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/180741-help-need-to-write-feedback-form/
Share on other sites

the code works fine on my server i got the email with you code

 

 

Sunday, November 8, 2009, 5:52 am [EST]

 

Message: jgkdjdlgj

 

From: bob (bob@******.org)

 

Additional Info :

 

IP = 72.187.151.217

 

Browser Info: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.28 Safari/530.5

 

Referral : http://bob.tdsnet.org/php/

Archived

This topic is now archived and is closed to further replies.

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