This article contains example of simple submit form with control of fulfilment of all fields and valdation. For proper testing of our code is used mercury e-mail server build in in XAMPP environment.
Next picture show visual look of submit form frontend that use bootstrap stylesheet downloaded from https://bootswatch.com/.
<a class=“navbar-brand“ href=“https://cdesigner.eu“> Visit us on CDesigner.eu </a>
</div>
</body>
</html>
PHP code grab $_POST[] submited variables, assign them into php code variables and test its content against filtering rules. First test detect content of all needed values as name, e-mail and mesage text. Next verifies e-mail against rules expected from valid e-mails.
If something is missing or e-mail is incorrect red (bootstrap alerted style) highlight in outputed text is used.
Also our code test sucessfull e-mail sending, if sendig finished correct green message display with text
$msg = ‚Your e-mail has been sent‘; $msgClass = ‚alert-success‘;
if sending was unsuccessful red message is displayed
$msg = ‚Your e-mail was not sent‘; $msgClass = ‚alert-danger‘;
For proper work of this code you must use appropriate webhosting or use XAMPP with runing mercury e-mail server. After enabling mercury through xamp control-panel go to administration and add new user. In our case we used account with name ciljak. local domain aliases that are posible to use are localhost (can not be validate with this code), localhost.net or localhost.org. Next picture show example of mercury enabled features in XAMPP server
For versioning of our code can be used git with github service. Mouch simpler graphical tool for commiting changes and share your code with team is gitkraken https://www.gitkraken.com/. For further reading please wisit next tutorial.
Our project setup screen in gitkraken looks like next picture
We inform you that we use cookies and other technologies on this site to function and improve the operation of the site, ensure it, provide social networking features, personalize content and ads to users, and analyze traffic and user behavior. For more information, please read our Terms of Use and Cookies. You can prevent cookies from being processed by changing the settings in your Internet browser.OkPrivacy policy