Friday, December 18, 2015

Simple feedback form for a closed network.

Always looking for ways to reduce paper consumption. To me little feedback pages are just the way
to do that. Here is one legacy form we like to use. 
 
 
 

<code> 
<html>
<title> Offshore Educators (Main Page) </title>
 <title> Send us some comments </title>
 <body bgcolor="aquamarine">    
    <CENTER><h2><B><I>Offshore Educators</I></B></h2></CENTER>
   <h2>Your Comments: </h2> 
    <p>
    By filling out this small form you can send us some comments.
    <p>
    <hr>

 <!--- Comment Form -->   
    <form ACTION="contact.php" method="post"> 
    
    
    Your name:<br>
    <input name="name" type="text" size=60> <br>
    
    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>
    
    <p>
    Your comments?<br>
    <textarea name="comment" COLS=60 ROWS=8></textarea><br>
    
    <p>
    <input type="submit" value="Send">
    <input type="reset" value="Clear"> 
    </form>

    </body>
</html>
<code>
 
<code>
 cat contact.php
<?php

// Get data and write it to file

$data_file = "data/feedback.dat";
$fp = fopen($data_file, "a");
fwrite($fp, "Username: ");
fwrite($fp, $_POST[name]);
fwrite($fp, "\n");
fwrite($fp, "Email address: ");
fwrite($fp, $_POST[email]);
fwrite($fp, "\n");
fwrite($fp, "Comment:\n");
fwrite($fp, $_POST[comment]);
fwrite($fp, "\n");
fwrite($fp, "-------------------------------------");
fwrite($fp, "\n");
fclose($fp);

// Let user know save is done and give a chance to go back to main page
print "<body bgcolor=\"aquamarine\">";
print "<h2><center>Offshore Educators - Feedback</center</h1>";
print "<br>";
print "<h3>Thank you for your comments!</h3>";
print "<br>";
print "<hr>";
print "<br>";
Print "<a href="http://oeorgan01"> Click on me to return to the homepage!</a>";
?>
</code> 

No comments:

Post a Comment