I would also like to add a email validation to it. How would I go about doing that without messing up the coding?
So basically even if the whole form is filled out, and the email is in the wrong format, then do the same thing as when the form isn't totally filled out. If the email is in the correct format but the whole form isnt filled out, then show an error message, I already have all that coded in, exept the email validation.
Can someone add that to my code?
PHP Code:
<?php
$form = '<form action="" method="POST">
Email Address:
<input size="40" type="text" value="' . $_POST["email_address"] . '" name="email_address"><br>
Username
<input size="40" type="text" value="' . $_POST["username"] . '" name="username"><br>
password
<input size="40" value="' . $_POST["password"] . '" type="text" name="password"><br>
<input id="submit" class="submit-button" type="submit" name="submit" value="Reset Password" >
</form>';
if (isset($_POST['submit'])) {
$blank_inputs = 0;
$test_array = array_count_values($_POST);
$blank_inputs = $test_array[""];
if ($blank_inputs > 0) {
//display an error message and put the form back up for editing
echo "Please fill out the whole form.<hr>";
echo $form;
} else {
echo 'message sent';
}
} else {
echo $form;
}
?>
__________________
█ MY MSN: Please login or register to view this content. Registration is FREE
█ PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
█ PM me anytime for HTML, PHP or web design help. I will be glad to help you out.
|