Client ID (three digits)

First Name 1

First Name 2

Last Name

Address

City

ZIP

function add_to_database( $client_id, $firstName1, $firstName2, $lastName, $address, $CITY, $zip, &$dberror) {
    import_request_variables("P");
    $user = "root";
    $pass = "inline";
    $db = "ritaClients";
    $link = mysql_connect("127.0.0.1", $user, $pass);
    if ( ! $link) {
         $dberror = "Could not connect to MySQL server";
         return false;
    }
    if ( ! mysql_select_db( $db, $link )) {
         $dberror = mysql_error();
         return false;
    }
    $query = "INSERT INTO clients ( client_id, firstName1, firstName2, lastName, address, CITY, zip) values( '$client_id', '$firstName1', '$firstName2', '$lastName', '$address', '$CITY', '$zip' )";
    if ( ! mysql_query($query,  $link )) {
         $dberror = mysql_error();
         return false;
    }
    return true;
}

function write_form() {
//    global $PHP_SELF;
    print "<form  action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">\n";
    print "<input type=\"text\" name=\"client_id\">";
    print "Client ID (three digits)<p>\n";
    print "<input type=\"text\" name=\"firstName1\">";
    print "First Name 1<p>\n";
    print "<input type=\"text\" name=\"firstName2\">";
    print "First Name 2<p>\n";
    print "<input type=\"text\" name=\"lastName\">";
    print "Last Name<p>\n";
    print "<input type=\"text\" name=\"address\">";
    print "Address<p>\n";
    print "<input type=\"text\" name=\"CITY\">";
    print "City<p>\n";
    print "<input type=\"text\" name=\"zip\">";
    print "ZIP<p>\n";
    print "<input type=\"submit\" value=\"submit\">\n\n";
}
if (isset($client_id) && isset($firstName1) && isset ($firstName2) && isset($lastName) && isset ($address) && isset ($CITY) && isset ($zip)) {
// check user input here
    $dberror = "";
$ret = add_to_database( $client_id, $firstName1, $firstName2, $lastName, $address, $CITY, $zip, $dberror );
    if ( ! $ret ) {
        print "Error: $dberror<br />"; 
     } else {
   print "Thank You."; 
    }
} else {
    write_form();
}