Example #1
0
function validateFormFields()
{
    if (empty($_POST["number"])) {
        sendResponse('EMPTY_PHONE_NUMBER_FIELD', 'error');
        return false;
    } else {
        $number = formatFormData($_POST["number"]);
        if (!preg_match("/^[0-9\\/-]+\$/", $number)) {
            sendResponse('INVALID_PHONE_NUMBER', 'error');
            return false;
        }
    }
    if (empty($_POST["email"])) {
        sendResponse('EMPTY_EMAIL_FIELD', 'error');
        return false;
    } else {
        $email = formatFormData($_POST["email"]);
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            sendResponse('INVALID_EMAIL_ID', 'error');
            return false;
        }
    }
    if ($_FILES["picToUpload"]['tmp_name'] == '') {
        sendResponse('EMPTY_FILE_FIELD', 'error');
        return false;
    }
    return true;
}
Example #2
0
        font-family: "Verdana";
        font-size: 1em;
        line-height: 215%;
        padding: 1.5% 0 1.5% 15%;
      }
      h4 {
        font-family: "Helvetica Neue";
        font-size: 1.2em;
        font-weight: 300;
        letter-spacing: 0.75px;
      }
      img {
        vertical-align: top;
        width: 35%;
      }
    </style>
  </head>
  <body>
    <p>
      <?php 
foreach (formatFormData() as $key => $value) {
    echo "{$key} &raquo; {$value}<br />";
}
$selfiePath = saveSelfie();
$selfieName = pathinfo($selfiePath, PATHINFO_BASENAME);
echo 'image &raquo; <img src="' . $selfiePath . '" alt="' . $selfieName . '">';
?>
    </p>
  </body>
</html>