Me Pez Me Pez



Home| Links Info| Partners| About Us| Listings
Register | Login  | Tutorials| Policies| Contact Us

 !  Form with PHP - thus far - Tutorial 3 - page 4

<?php
if (isset($_POST['submit'])) { // if the form was submitted.
echo ('<p>Form was submitted.</p>');

$date = date('F j, Y G:i:s');
$first = stripslashes ($_POST['firstname']);
$last = stripslashes ($_POST['lastname']);
$email = stripslashes ($_POST['email']);
$comment = stripslashes ($_POST['comments']);
$refer = getenv("HTTP_REFERER") ;

if (empty($first) && empty($last) && empty($email) && empty($comment)) {
echo ('<p>The form is blank. As is, the form will be ignored.</p>');
} else {

if (eregi("\r",$first) || eregi("\n",$first) )
{
die("To prevent someone from spamming from the firstname section of this form, certain special characters and phrases trigger this form to shut down. The special characters and phrases appear after the following equal sign. If nothing suspicious shows immediately after the equal sign, the missing characters are in machine language or are coded characters - characters like the carriage return or the new line character... Invalid input = $first.");
}
if (eregi("\r",$last) || eregi("\n",$last) )
{
die("To prevent someone from spamming from the lastname section of this form, certain special characters and phrases trigger this form to shut down. The special characters and phrases appear after the following equal sign. If nothing suspicious shows immediately after the equal sign, the missing characters are in machine language or are coded characters - characters like the carriage return or the new line character... Invalid input = $last.");
}
if (eregi("\r",$email) || eregi("\n",$email) )
{
die("To prevent someone from spamming from the email section of this form, certain special characters and phrases trigger this form to shut down. The special characters and phrases appear after the following equal sign. If nothing suspicious shows immediately after the equal sign, the missing characters are in machine language or are coded characters - characters like the carriage return or the new line character... Invalid input = $email.");
}
if (eregi("\r",$comment) || eregi("\n",$comment) )
{
die("Please find another way of making your comment. To prevent someone from spamming from the comment section of this form, certain special characters and phrases trigger this form to shut down. The special characters and phrases appear after the following equal sign. If nothing suspicious shows immediately after the equal sign, the missing characters are in machine language or are coded characters - characters like the carriage return or the new line character... Invalid input = $comment.");
}

$mailto = "you@youremail.com";
$subject = "Guest Comment from YOUR WEB SITE.COM";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
$headers .= 'From: you <you@yourotheremail.com>' . "\r\n";
$body = "$date From: $refer.\n A guest, $first $last\n whose return email is: $email\n has made this comment:\n $comment\n";
// mail($mailto,$subject,$body,$headers);

$guest_data = "$date\t$refer\t$first\t$last\n\t$email\n\t$comment\n";
if ($fp = @fopen ("guests.txt", "a")) { // Open the file for writing.
// fwrite ($fp, $guest_data);
fclose ($fp);
echo ('<p>Program executed O.K.</p>');
// echo ('<p>Info filed away in a tabbed array for future reference.</p>');
}

}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Guest Comment</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>

<body>

<table bgcolor="#000000" align="center">
<tr><td colspan="2" align="center"><h2><font color="#FFFFFF">Guest Comment</font></h2></td></tr>
<form name="guest_comment_form" action="commentz.php" method="post">
<tr><td align="right"><font color="#FFFFFF">First Name</td>
<td align="left"><input type="text" name="firstname" size="25" maxsize="20"> </td></tr><tr>
<td align="right"> <font color="#FFFFFF">Last Name</td>
<td align="left"><input type="text" name="lastname" size="25" maxsize="20"></td></tr>
<tr><td align="right"><font color="#FFFFFF">Email Address</td>
<td align="left"><input type="text" name="email" size="25" maxsize="60""></td></tr>
<tr><td align="right"><font color="#FFFFFF">Comments or Questions</td>
<td align="left"><textarea name="comments" rows="4" cols="40"></textarea></td></tr>
<tr><td align="center" colspan="2"><input type="submit" name="submit" value="Submit!">
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
</body></html>


Click here to return to page 4 of the third tutorial.


Your IP address is: 38.103.63.59
 !   Sponsors

We'd like to thank our sponsors for their encouragement and support. If you can use their services, please support us by supporting them.


 !   Dev Shed
Dev Shed - The Open Source Web Development Site Dev Shed
Powered By Dev Shed

More >>
 !   Dev Shed Forum
Dev Shed - The Open Source Web Development Site Dev Shed
Powered By Dev Shed

More >>
 !   Tutorials





Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
More >>

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
More >>

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
More >>

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
More >>

adsense_anim
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
More >>

©2005 ME PEZ BLOGSNOVELSESCAPESHOMEFAQsPOLICIES
REGISTERLOGINFORGOT YOUR PASSWORD?