Make your own free website on

Visit the Official PHP Website

Search this Site

PHP Programming

By James N Hitz

The Code

Our code that actually tests the form input to validate and process is as follows:

<html><head><title>Your Suggestions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="black" text="white">
 if(trim($fName) ==""){
   $missing =  "<p>The <b>First Name</b> has not been provided.";
 }elseif(!preg_match("/^\w+$/", $fName)){
   $missing .= "<p><b>First Name</b> contains invalid character(s)";

   $missing .= "<p>The <b>Last Name</b> contains invalid character(s)";
   $missing .= "<p>Invalid <b>Email Address</b> Provided.";
 if(trim($suggestion) ==""){
    $missing .= "<p><b>Suggestion</b> is blank.";
 if(trim($missing) != ""){
    print "<p>There are a few problems with your data entry:</p>". $missing;
} else {
    print "<h2>Thank You</h2>".
     "<p>Hello <b>". $fName . " " . $lName . "</b><p>Your suggesstions state that".
     "<br><b>$suggestion</b>\.  Your email address <b>". 
     $eAddress . "</b> is valid";

<< The Interface | The Code Explained >>

JamHitz Productions