Feedback Form Code / Instructions

Feedback Form Code / Instructions

The source code for the two files (feedback.php and feedout.php) is shown below. Copy and paste the feedback.php into your existing php page. Then copy and paste the output and Thank You page into your existing Thank You page / template.
BTW: In the feedout.php file you must enter your 'from' and 'to' email address information.
VIP: The web host must have PHP safe mode OFF and the mail() function is required.
If not sure about Safe Mood, BE SURE to make and run a test.php (see notes)

feedback.php

<form action="feedout.php" method="post">
<!-- 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 ?>" />
<h2 align="center">Feedback Form</h2>
<p>
All input is blah blah ...... </p>
<p>Send Data to: <select name="attn" size="1">
<option value=" MT General Email ">General Email</option>
<option value=" MakeTemplate Owner ">Owner of MakeTemplate</option>
<option value=" Technical Support ">Technical Support</option>
<option value=" PHP Codemaster ">PHP Codemaster</option>
</select>
<br />
Name: <input type="text" name="nameis" size="20" /> Email:<input type="text" name="visitormail" size="20" />


<br/> Overall Rating:<br/> [<input checked="checked" name="rating" type="radio" value="good" /> Good]   [<input name="rating" type="radio" value="bad" /> Bad]   [<input name="rating" type="radio" value="ugly" /> Ugly]
</p>
<p> Request additional features for a feedback tutorial:<br />
<input type="checkbox" name="emailvalidation" value="y" /> Email 'format' Validation - check @<br />
<input type="checkbox" name="fieldvalidation" value="y" /> Required Form Field Validation.<br />
<input type="checkbox" name="htmlcontrol" value="y" /> More intergratd HTML (in form).<br />
<input type="checkbox" name="phpform" value="y" /> Improved PHP form script generator.<br />
<input type="checkbox" name="htmlform" value="y" /> A complete HTML form generator. <br />
</p>
<br />
<h3 align="center">General Comments</h3>
<p align="center">
<textarea name="feedback" rows="6" cols="30">Notes n comments here</textarea>
</p>
<hr />
<p align="center">
<input type="submit" value="Submit Feedback" />
</p>
<p>

</p>
</form>


feedout.php



<h3 align="center">Thanks for your Feedback </h3>
<!-- VIP: change YourEmail to your real email -->

<?php

$ip = $_POST['ip'];
$httpagent = $_POST['httpagent'];
$httpref = $_POST['$httpref'];
$nameis = $_POST['nameis'];
$visitormail = $_POST['visitormail'];
$feedback = $_POST['feedback'];
$rating = $_POST['rating'];
$emailvalidation = $_POST['emailvalidation'];
$fieldvalidation = $_POST['fieldvalidation'];
$htmlcontrol= $_POST['htmlcontrol'];
$phpform = $_POST['phpform'];
$htmlform = $_POST['htmlform'];
$attn = $_POST['attn'];

if (eregi('http:', $feedback)) { die ("Do NOT try that! ! "); }

if((!$visitormail == "") && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$tellem = "<h2>Feedback was NOT submitted</h2>\n";
}

if(empty($nameis) || empty($feedback) || empty($visitormail)) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}

echo $tellem;

if ($emailvalidation == "y") {
$req1 = "Email format Validation \n" ;
}

if ($fieldvalidation == "y") {
$req2 = "Required Form Field Validation \n";
}
if ($htmlcontrol == "y") {
$req3 = "More intergratd HTML (in form) \n";
}
if ($phpform == "y") {
$req4 = "Improved PHP form script generator \n";
}
if ($htmlform == "y") {
$req5 = "A complete HTML form generator \n";
}
$req = $req1 . $req2 . $req3 . $req4 . $req5;

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn;
$subject = $attn;

$feedback = stripcslashes($feedback);

$message = " $todayis [EST] \n
Attention: $attn (Rating: $rating) \n
From: $nameis ($visitormail)\n
Requested:
$req \n
Feedback: $feedback \n
Additional Info : IP = $ip \n
Browser = $httpagent \n
Referral = $httpref
";

$from = "From: $visitormail\r\n";

mail("YourEmail", $subject, $message, $from);


$screenout = str_replace("\n", "<br/>", $message);
?>


<p align="center">

<?php echo $screenout ?>

</p>

  • 15 Users Found This Useful
Was this answer helpful?

Related Articles

Perl-based Form Mail (Feedback) Script

 Perl-based Form Mail (Feedback) ScriptUsing a Perl script you may accept feedback from your...

Optimizing WordPress

Wordpress is currently one of the most popular blogging/CMS applications. Here are some ideas for...

PHP sendmail Settings

Using phpMailer to Send Mail through PHP Download the PHPMailer script First, download...

Memory Allocation Error. Create a custom php.ini for PHP 5.2

Some programs produce errors in which it says the memory allocation is limited to 32MB and that...

301 Redirect from non-www to ww -- Without Looping!

o - you want to improve your search engine rankings, and SEO gurus told you that Google might be...