This is my first php and contact form coding/testing with the XAMPP. I'm very confused in which part of my contact.php should I insert the php script in order to send all the filled form to the my email address or XAMPP for the test? Should I create another php file or should I put the script inside the contact.php? These are all the files which are related to the contact.php.
- contact.php (main sheet I've been working on)
- validate.php (imported to contact.php ONLY to validate the form fields)
- validate.js (functions in this file have been called in contact.php)
<<<<<<<<<<<<<< Contact.php >>>>>>>>>>>>>>
<body>
<div id="error">
<ul>
<?if(!validateName($_POST['name'])):?>
<li><strong>Invalid Name:</strong>Required more than 3 letters!</li>
<?endif?>
<?if(!validateSurname($_POST['surname'])):?>
<li><strong>Invalid Surname:</strong>Required more than 3 letters!</li>
<?endif?>
<?if(!validateEmail($_POST['email'])):?>
<li><strong>Invalid E-mail:</strong>Invalid email-address format!</li>
<?endif?>
<?if(!validateMessage($_POST['message'])):?>
<li><strong>Invalid Message:</strong>Required more than 3 letters</li>
<?endif?>
<?if(!validateHuman($_POST['human'])):?>
<li><strong>Answer Incorrect:</strong>Human Validation Failed</li>
<?endif?>
</ul>
</div>
<?elseif(isset($_POST['send'])):?>
<div id="error" class="valid">
<ul>
<li><strong>Congratulations!</strong></li>
</ul>
</div>
<?endif?>
<form method="post" id="customForm" action="????.php">
.
.
.
<input id="send" name="send" type="submit" value="Send" />
</form>
<script type="text/javascript" src="js/validation.js"></script>
</body>