html contact form with php mail code example

Example 1: how to connect contact form to email in php

<html>
<head>
	<title>PHP Contact Form - The Email Method - Hyvor Developer</title>
</head>
<body>

<form method="POST" action=""> 
	<div class="input-wrap">
		<span class="label">Email:</span>
		<input type="text" name="email">
	</div>
	<div class="input-wrap">
		<span class="label">Message:</span>
		<textarea name="message"></textarea>
	</div>
	<div class="input-wrap">
		<input type="submit" name="submit" value="Submit" class="submit-button">
	</div>

</form>

</body>
</html>

Example 2: how to connect contact form to email in php

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	// your other code here
}

Tags:

Php Example